java.lang.NullPointerException

DataStax JIRA | Piotr Kołaczkowski | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    {noformat} import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; public class ConnectionTest { public static void main(String[] args) throws InterruptedException { Cluster cluster = new Cluster.Builder().addContactPoint("127.0.0.1").build(); for (int i = 0; i < 10000; i++) { Session session = cluster.connect(); session.close(); } Thread.sleep(100000); cluster.close(); } } {noformat} Attach jvisualvm when this program reaches Thread.sleep call and do a heap-dump. There will be 10000 instances of SessionManager and >10000 instances of SocketChannelImpl. The program suffers connection problems during the run: {noformat} ERROR 13:40:53,510 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,510 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,520 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,520 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:54,521 [Control connection] Cannot connect to any host, scheduling retry in 2000 milliseconds ERROR 13:40:56,522 [Control connection] Cannot connect to any host, scheduling retry in 4000 milliseconds ERROR 13:41:00,522 [Control connection] Cannot connect to any host, scheduling retry in 8000 milliseconds ERROR 13:41:08,523 [Control connection] Cannot connect to any host, scheduling retry in 16000 milliseconds ERROR 13:41:24,523 [Control connection] Cannot connect to any host, scheduling retry in 32000 milliseconds ERROR 13:41:56,524 [Control connection] Cannot connect to any host, scheduling retry in 64000 milliseconds 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x1e3e1609] EXCEPTION: java.net.BindException: Cannot assign requested address) java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) at com.datastax.driver.core.Cluster$Manager.triggerOnDown(Cluster.java:1342) at com.datastax.driver.core.Cluster$Manager.signalConnectionFailure(Cluster.java:1550) at com.datastax.driver.core.Connection.defunct(Connection.java:247) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:131) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:70) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.channel.Channels.connect(Channels.java:634) at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:207) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182) at com.datastax.driver.core.Connection.<init>(Connection.java:93) at com.datastax.driver.core.PooledConnection.<init>(PooledConnection.java:28) at com.datastax.driver.core.Connection$Factory.open(Connection.java:456) at com.datastax.driver.core.HostConnectionPool.<init>(HostConnectionPool.java:85) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:190) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:186) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x0757b1d4] EXCEPTION: java.net.BindException: Cannot assign requested address) java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) at com.datastax.driver.core.Cluster$Manager.triggerOnDown(Cluster.java:1342) at com.datastax.driver.core.Cluster$Manager.signalConnectionFailure(Cluster.java:1550) at com.datastax.driver.core.Connection.defunct(Connection.java:247) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:131) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:70) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.channel.Channels.connect(Channels.java:634) at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:207) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182) at com.datastax.driver.core.Connection.<init>(Connection.java:93) at com.datastax.driver.core.PooledConnection.<init>(PooledConnection.java:28) at com.datastax.driver.core.Connection$Factory.open(Connection.java:456) at com.datastax.driver.core.HostConnectionPool.<init>(HostConnectionPool.java:85) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:190) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:186) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x8787bc74, /127.0.0.1:50027 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0xdeb37992, /127.0.0.1:55446 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x87e23fce, /127.0.0.1:38588 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x14b239f4, /127.0.0.1:37010 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) {noformat}

    DataStax JIRA | 3 years ago | Piotr Kołaczkowski
    java.lang.NullPointerException
  2. 0

    {noformat} import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; public class ConnectionTest { public static void main(String[] args) throws InterruptedException { Cluster cluster = new Cluster.Builder().addContactPoint("127.0.0.1").build(); for (int i = 0; i < 10000; i++) { Session session = cluster.connect(); session.close(); } Thread.sleep(100000); cluster.close(); } } {noformat} Attach jvisualvm when this program reaches Thread.sleep call and do a heap-dump. There will be 10000 instances of SessionManager and >10000 instances of SocketChannelImpl. The program suffers connection problems during the run: {noformat} ERROR 13:40:53,510 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,510 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,520 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:53,520 [Control connection] Cannot connect to any host, scheduling retry ERROR 13:40:54,521 [Control connection] Cannot connect to any host, scheduling retry in 2000 milliseconds ERROR 13:40:56,522 [Control connection] Cannot connect to any host, scheduling retry in 4000 milliseconds ERROR 13:41:00,522 [Control connection] Cannot connect to any host, scheduling retry in 8000 milliseconds ERROR 13:41:08,523 [Control connection] Cannot connect to any host, scheduling retry in 16000 milliseconds ERROR 13:41:24,523 [Control connection] Cannot connect to any host, scheduling retry in 32000 milliseconds ERROR 13:41:56,524 [Control connection] Cannot connect to any host, scheduling retry in 64000 milliseconds 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x1e3e1609] EXCEPTION: java.net.BindException: Cannot assign requested address) java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) at com.datastax.driver.core.Cluster$Manager.triggerOnDown(Cluster.java:1342) at com.datastax.driver.core.Cluster$Manager.signalConnectionFailure(Cluster.java:1550) at com.datastax.driver.core.Connection.defunct(Connection.java:247) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:131) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:70) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.channel.Channels.connect(Channels.java:634) at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:207) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182) at com.datastax.driver.core.Connection.<init>(Connection.java:93) at com.datastax.driver.core.PooledConnection.<init>(PooledConnection.java:28) at com.datastax.driver.core.Connection$Factory.open(Connection.java:456) at com.datastax.driver.core.HostConnectionPool.<init>(HostConnectionPool.java:85) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:190) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:186) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x0757b1d4] EXCEPTION: java.net.BindException: Cannot assign requested address) java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) at com.datastax.driver.core.Cluster$Manager.triggerOnDown(Cluster.java:1342) at com.datastax.driver.core.Cluster$Manager.signalConnectionFailure(Cluster.java:1550) at com.datastax.driver.core.Connection.defunct(Connection.java:247) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:131) at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:70) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) at org.jboss.netty.channel.Channels.connect(Channels.java:634) at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:207) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:229) at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182) at com.datastax.driver.core.Connection.<init>(Connection.java:93) at com.datastax.driver.core.PooledConnection.<init>(PooledConnection.java:28) at com.datastax.driver.core.Connection$Factory.open(Connection.java:456) at com.datastax.driver.core.HostConnectionPool.<init>(HostConnectionPool.java:85) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:190) at com.datastax.driver.core.SessionManager$2.call(SessionManager.java:186) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x8787bc74, /127.0.0.1:50027 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0xdeb37992, /127.0.0.1:55446 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x87e23fce, /127.0.0.1:38588 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) 10-Jul-2014 13:42:54 org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x14b239f4, /127.0.0.1:37010 :> /127.0.0.1:9042] EXCEPTION: java.lang.NullPointerException) java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:248) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.Channels$6.run(Channels.java:457) at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) {noformat}

    DataStax JIRA | 3 years ago | Piotr Kołaczkowski
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    This NPE showed up in our production. java.lang.NullPointerException at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:396) at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:383) at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) at com.datastax.driver.core.Connection.defunct(Connection.java:246) at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:614) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:375) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:93) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

    DataStax JIRA | 2 years ago | Vishy Kasar
    java.lang.NullPointerException
  5. 0

    Our threads are dying and the application grinds to a halt because of a NPE thrown from HostConnectionPool.discardAvailableConnections(). {code} INFO | jvm 3 | 2014/10/12 23:20:24 | WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0xd50a8813, /10.69.8.46:33600 :> hostname/10.69.8.235:9042] EXCEPTION: java.lang.NullPointerException) INFO | jvm 3 | 2014/10/12 23:20:24 | java.lang.NullPointerException INFO | jvm 3 | 2014/10/12 23:20:24 | at com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:396) INFO | jvm 3 | 2014/10/12 23:20:24 | at com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:383) INFO | jvm 3 | 2014/10/12 23:20:24 | at com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48) INFO | jvm 3 | 2014/10/12 23:20:24 | at com.datastax.driver.core.Connection.defunct(Connection.java:246) INFO | jvm 3 | 2014/10/12 23:20:24 | at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:614) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:375) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:93) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) INFO | jvm 3 | 2014/10/12 23:20:24 | at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) INFO | jvm 3 | 2014/10/12 23:20:24 | at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) INFO | jvm 3 | 2014/10/12 23:20:24 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) INFO | jvm 3 | 2014/10/12 23:20:24 | at java.lang.Thread.run(Thread.java:662) {code}

    DataStax JIRA | 3 years ago | Constantin Muraru
    java.lang.NullPointerException

    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.HostConnectionPool.discardAvailableConnections()
    2. DataStax Java Driver for Apache Cassandra - Core
      Connection$Dispatcher.exceptionCaught
      1. com.datastax.driver.core.HostConnectionPool.discardAvailableConnections(HostConnectionPool.java:402)
      2. com.datastax.driver.core.HostConnectionPool.closeAsync(HostConnectionPool.java:389)
      3. com.datastax.driver.core.PooledConnection.notifyOwnerWhenDefunct(PooledConnection.java:48)
      4. com.datastax.driver.core.Connection.defunct(Connection.java:248)
      5. com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:612)
      5 frames
    3. Netty
      NioWorker.run
      1. org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60)
      2. org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377)
      3. org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525)
      4. org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48)
      5. org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60)
      6. org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493)
      7. org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371)
      8. org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468)
      9. org.jboss.netty.channel.Channels$6.run(Channels.java:457)
      10. org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:40)
      11. org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
      12. org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
      13. org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
      14. org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
      14 frames
    4. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      3. java.lang.Thread.run(Thread.java:662)
      3 frames