java.lang.NullPointerException

DataStax JIRA | Yohan Liyanage | 1 year ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    We are trying to access Cassandra from a Spark application directly using the Cassandra Java Driver (not the spark-connector). We see the following exception being logged in our worker nodes intermittently. Everything looks to be working fine first, but after some time, we see this exception getting logged. After this exception is logged, the connection fails and soon after we get com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried). We are using Datastax driver 2.1.7.1 against Cassandra 2.1.11 (Datastax Community). Stack trace and trace log is as follows: 2016-01-26 17:54:01.875 DEBUG - [r2-nio-worker-3] [5ca87f65-2ddc-4a45-8d01-22811dd1b6d1] com.datastax.driver.core.Connection : Connection[/192.172.2.51:9042-1, inFlight=0, closed=false] connection error java.lang.NullPointerException at com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum(ProtocolOptions.java:178) at com.datastax.driver.core.QueryLogger.protocolVersion(QueryLogger.java:753) at com.datastax.driver.core.QueryLogger.parameterValueAsString(QueryLogger.java:738) at com.datastax.driver.core.QueryLogger.appendParameters(QueryLogger.java:709) at com.datastax.driver.core.QueryLogger.logQuery(QueryLogger.java:647) at com.datastax.driver.core.QueryLogger.maybeLogNormalQuery(QueryLogger.java:631) at com.datastax.driver.core.QueryLogger$ConstantThresholdQueryLogger.maybeLogNormalOrSlowQuery(QueryLogger.java:278) at com.datastax.driver.core.QueryLogger.update(QueryLogger.java:620) at com.datastax.driver.core.Cluster$Manager.reportLatency(Cluster.java:1422) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:991) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:913) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:745) 2016-01-26 17:54:01.876 DEBUG - [r2-nio-worker-3] [5ca87f65-2ddc-4a45-8d01-22811dd1b6d1] com.datastax.driver.core.Connection : Defuncting connection to /192.172.2.51:9042 com.datastax.driver.core.TransportException: [/192.172.2.51:9042] Unexpected exception triggered (java.lang.NullPointerException) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:1028) at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:271) at io.netty.channel.AbstractChannelHandlerContext.notifyHandlerException(AbstractChannelHandlerContext.java:768) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum(ProtocolOptions.java:178) at com.datastax.driver.core.QueryLogger.protocolVersion(QueryLogger.java:753) at com.datastax.driver.core.QueryLogger.parameterValueAsString(QueryLogger.java:738) at com.datastax.driver.core.QueryLogger.appendParameters(QueryLogger.java:709) at com.datastax.driver.core.QueryLogger.logQuery(QueryLogger.java:647) at com.datastax.driver.core.QueryLogger.maybeLogNormalQuery(QueryLogger.java:631) at com.datastax.driver.core.QueryLogger$ConstantThresholdQueryLogger.maybeLogNormalOrSlowQuery(QueryLogger.java:278) at com.datastax.driver.core.QueryLogger.update(QueryLogger.java:620) at com.datastax.driver.core.Cluster$Manager.reportLatency(Cluster.java:1422) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:991) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:913) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) ... 16 more

    DataStax JIRA | 1 year ago | Yohan Liyanage
    java.lang.NullPointerException
  2. 0

    We are trying to access Cassandra from a Spark application directly using the Cassandra Java Driver (not the spark-connector). We see the following exception being logged in our worker nodes intermittently. Everything looks to be working fine first, but after some time, we see this exception getting logged. After this exception is logged, the connection fails and soon after we get com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried). We are using Datastax driver 2.1.7.1 against Cassandra 2.1.11 (Datastax Community). Stack trace and trace log is as follows: 2016-01-26 17:54:01.875 DEBUG - [r2-nio-worker-3] [5ca87f65-2ddc-4a45-8d01-22811dd1b6d1] com.datastax.driver.core.Connection : Connection[/192.172.2.51:9042-1, inFlight=0, closed=false] connection error java.lang.NullPointerException at com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum(ProtocolOptions.java:178) at com.datastax.driver.core.QueryLogger.protocolVersion(QueryLogger.java:753) at com.datastax.driver.core.QueryLogger.parameterValueAsString(QueryLogger.java:738) at com.datastax.driver.core.QueryLogger.appendParameters(QueryLogger.java:709) at com.datastax.driver.core.QueryLogger.logQuery(QueryLogger.java:647) at com.datastax.driver.core.QueryLogger.maybeLogNormalQuery(QueryLogger.java:631) at com.datastax.driver.core.QueryLogger$ConstantThresholdQueryLogger.maybeLogNormalOrSlowQuery(QueryLogger.java:278) at com.datastax.driver.core.QueryLogger.update(QueryLogger.java:620) at com.datastax.driver.core.Cluster$Manager.reportLatency(Cluster.java:1422) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:991) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:913) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:745) 2016-01-26 17:54:01.876 DEBUG - [r2-nio-worker-3] [5ca87f65-2ddc-4a45-8d01-22811dd1b6d1] com.datastax.driver.core.Connection : Defuncting connection to /192.172.2.51:9042 com.datastax.driver.core.TransportException: [/192.172.2.51:9042] Unexpected exception triggered (java.lang.NullPointerException) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:1028) at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:271) at io.netty.channel.AbstractChannelHandlerContext.notifyHandlerException(AbstractChannelHandlerContext.java:768) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum(ProtocolOptions.java:178) at com.datastax.driver.core.QueryLogger.protocolVersion(QueryLogger.java:753) at com.datastax.driver.core.QueryLogger.parameterValueAsString(QueryLogger.java:738) at com.datastax.driver.core.QueryLogger.appendParameters(QueryLogger.java:709) at com.datastax.driver.core.QueryLogger.logQuery(QueryLogger.java:647) at com.datastax.driver.core.QueryLogger.maybeLogNormalQuery(QueryLogger.java:631) at com.datastax.driver.core.QueryLogger$ConstantThresholdQueryLogger.maybeLogNormalOrSlowQuery(QueryLogger.java:278) at com.datastax.driver.core.QueryLogger.update(QueryLogger.java:620) at com.datastax.driver.core.Cluster$Manager.reportLatency(Cluster.java:1422) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:991) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:913) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) ... 16 more

    DataStax JIRA | 1 year ago | Yohan Liyanage
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Getting a nullpointer exception when switching displayables in J2ME

    Stack Overflow | 6 years ago | Pallinder
    java.lang.NullPointerException: 0 at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46 at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74 at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37 at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36 at com.sun.midp.chameleon.CWindow.keyInput(), bci=38 at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17 at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277 at com.sun.midp.events.EventQueue.run(), bci=179
  5. 0

    J2ME (Java) - Null Pointer Exception caught in Display Class

    Stack Overflow | 6 years ago | Tom
    java.lang.NullPointerException: 0 at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46 at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74 at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37 at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36 at com.sun.midp.chameleon.CWindow.keyInput(), bci=38 at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17 at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277 at com.sun.midp.events.EventQueue.run(), bci=179

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum()
    2. DataStax Java Driver for Apache Cassandra - Core
      Connection$Dispatcher.channelRead0
      1. com.datastax.driver.core.ProtocolOptions.getProtocolVersionEnum(ProtocolOptions.java:178)
      2. com.datastax.driver.core.QueryLogger.protocolVersion(QueryLogger.java:753)
      3. com.datastax.driver.core.QueryLogger.parameterValueAsString(QueryLogger.java:738)
      4. com.datastax.driver.core.QueryLogger.appendParameters(QueryLogger.java:709)
      5. com.datastax.driver.core.QueryLogger.logQuery(QueryLogger.java:647)
      6. com.datastax.driver.core.QueryLogger.maybeLogNormalQuery(QueryLogger.java:631)
      7. com.datastax.driver.core.QueryLogger$ConstantThresholdQueryLogger.maybeLogNormalOrSlowQuery(QueryLogger.java:278)
      8. com.datastax.driver.core.QueryLogger.update(QueryLogger.java:620)
      9. com.datastax.driver.core.Cluster$Manager.reportLatency(Cluster.java:1422)
      10. com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607)
      11. com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:991)
      12. com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:913)
      12 frames
    3. Netty
      SingleThreadEventExecutor$2.run
      1. io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
      2. io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
      3. io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
      4. io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254)
      5. io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
      6. io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
      7. io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
      8. io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
      9. io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
      10. io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
      11. io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
      12. io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
      13. io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
      14. io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722)
      15. io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326)
      16. io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264)
      17. io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
      17 frames
    4. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame