读取kafka主题时出现ArrayIndexOutOfBoundsException

时间:2017-09-28 03:14:52

标签: apache-kafka kafka-consumer-api spring-kafka

在阅读kafka主题时,我得到了奇怪的ArrayIndexOutOfBoundsException。花了很多时间但无法弄清楚这个问题。任何人都可以帮助/建议任何事情。这是我的日志。

[2017-09-28 01:53:04,341][][][INFO][qtp1961176822-1087][o.a.k.c.c.i.ConsumerCoordinator]Setting newly assigned partitions [restopic_v1-8, restopic_v1-9, restopic_v1-2, restopic_v1-3, restopic_v1-0, restopic_v1-1, restopic_v1-6, restopic_v1-7, restopic_v1-4, restopic_v1-5] for group qa-service-0e6b927f-a167-4144-804d-64a5a14413ae
        [2017-09-28 01:53:04,477][][][INFO][qtp1961176822-1087][b.z.q.c.AvroMessageController]record = ConsumerRecord(topic = restopic_v1, partition = 9, offset = 2179, CreateTime = 1506301740847, checksum = 1852491863, serialized key size = 44, serialized value size = 7312, key = [B@628e6c6b, value = [B@193a970f)
        [2017-09-28 01:53:04,512][][][WARN][qtp1961176822-1087][o.e.jetty.server.HttpChannel]/kafka_avro/v1/message_queries
        org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ArrayIndexOutOfBoundsException
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
            at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
            at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
            at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
            at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
            at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
            at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
            at org.eclipse.jetty.server.Server.handle(Server.java:564)
            at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)

1 个答案:

答案 0 :(得分:0)

对不起,这是我身边的问题。无法反序列化kafka消息,因此它抛出了异常。使用适当的反序列化方法修复它。