title: Problems connecting to Cassandra pool from Spring application
body: <p>I hope, that someone is actually able to help, because I'm currently stuck on trying to work with Cassandra ATM.</p>
  
  <p>My Set up:
  For development, I have a minimal Cassandra 3.0.4 cluster with two nodes (one on my working machine, one in a VM). Usually only the local one is up and running.
  I use the latest Java driver version 3.0.0 to connect to the pool.</p>
  
  <p>My cassandra.yaml contains <code>rpc_address</code> and <code>listen_address</code> to the IP of each node. The seed is my primary working machine.</p>
  
  <p>My Problem:
  Everything is working fine from cqlsh (at any time) and when both nodes are up an running (from Java). But as soon as I stop the one in the VM, my Spring based application is throwing errors during startup:</p>
  
  <pre><code>2016-03-29 09:05:33.515 | INFO  | main                 | com.datastax.driver.core.NettyUtil                          :83    | Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
  2016-03-29 09:05:34.147 | INFO  | main                 | com.datastax.driver.core.policies.DCAwareRoundRobinPolicy   :95    | Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
  2016-03-29 09:05:34.149 | INFO  | main                 | com.datastax.driver.core.Cluster$Manager                    :1475  | New Cassandra host /10.20.30.74:9042 added
  2016-03-29 09:05:34.149 | INFO  | main                 | com.datastax.driver.core.Cluster$Manager                    :1475  | New Cassandra host /10.20.30.77:9042 added
  2016-03-29 09:05:34.150 | INFO  | main                 | my_company.cassandra.dao.impl.CassandraDaoImpl     :55    | Connected to cluster: TestCaseCluster
  2016-03-29 09:05:34.151 | INFO  | main                 | my_company.cassandra.dao.impl.CassandraDaoImpl     :57    | Datacenter: datacenter1; Host: /10.20.30.74; Rack: rack1, State: UP|true
  2016-03-29 09:05:34.151 | INFO  | main                 | my_company.cassandra.dao.impl.CassandraDaoImpl     :57    | Datacenter: datacenter1; Host: /10.20.30.77; Rack: rack1, State: UP|true
  2016-03-29 09:05:34.220 | WARN  | luster1-nio-worker-2 | com.datastax.driver.core.SessionManager$7                   :378   | Error creating pool to /10.20.30.77:9042
  com.datastax.driver.core.exceptions.ConnectionException: [/10.20.30.77] Pool was closed during initialization
      at com.datastax.driver.core.HostConnectionPool$2.onSuccess(HostConnectionPool.java:149) [cassandra-driver-core-3.0.0.jar:?]
      at com.datastax.driver.core.HostConnectionPool$2.onSuccess(HostConnectionPool.java:135) [cassandra-driver-core-3.0.0.jar:?]
      at com.google.common.util.concurrent.Futures$4.run(Futures.java:1181) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$CombinedFuture.setOneValue(Futures.java:1626) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$CombinedFuture.access$400(Futures.java:1470) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$CombinedFuture$2.run(Futures.java:1548) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$FallbackFuture$1$1.onSuccess(Futures.java:475) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$4.run(Futures.java:1181) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$ImmediateFuture.addListener(Futures.java:102) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1184) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$FallbackFuture$1.onFailure(Futures.java:472) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$4.run(Futures.java:1172) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:202) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$FallbackFuture$1$1.onFailure(Futures.java:483) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$4.run(Futures.java:1172) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:101) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:170) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1184) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$FallbackFuture$1.onFailure(Futures.java:472) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$4.run(Futures.java:1172) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:202) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:857) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:202) [guava-16.0.1.jar:?]
      at com.google.common.util.concurrent.SettableFuture.setException(SettableFuture.java:68) [guava-16.0.1.jar:?]
      at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:157) [cassandra-driver-core-3.0.0.jar:?]
      at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:140) [cassandra-driver-core-3.0.0.jar:?]
      at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) [netty-common-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603) [netty-common-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563) [netty-common-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424) [netty-common-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:276) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:292) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-common-4.0.33.Final.jar:4.0.33.Final]
      at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
  </code></pre>
  
  <p>In this example, I find the follwing line interessting:</p>
  
  <pre><code>Datacenter: datacenter1; Host: /10.20.30.77; Rack: rack1, State: UP|true
  </code></pre>
  
  <p>Because this is the mentioned VM, that is actually down:</p>
  
  <pre><code>Datacenter: datacenter1
  =======================
  Status=Up/Down
  |/ State=Normal/Leaving/Joining/Moving
  --  Address      Load       Tokens       Owns (effective)  Host ID                               Rack
  DN  10.20.30.77  89.12 KB   256          100.0%            197f6f0f-b820-4ab8-b7ef-bcc8773a345c  rack1
  UN  10.20.30.74  96.26 KB   256          100.0%            db7d053b-f8d1-4a59-9cb2-3abf54b24687  rack1
  </code></pre>
  
  <p>Where DN should mean "Down" &amp; "Normal", according to this excerpt from  <code>nodetools status</code>.
  So as far as I understand it, the Java driver doesn't recognize the second node as down and still tries to connect to it, because it's in the list of (available) nodes.</p>
  
  <p>Cas this be an incompatibility issues, because of the combination of driver version and Cassandra version? But I thought, they are compatible:
  <a href="http://datastax.github.io/java-driver/" rel="noreferrer">DataStax Java-Driver documentation on GitHub</a></p>
  
  <p>Please ask, if you need more info. I will update this text accordingly.</p>
  
  <p>Thanks and regards.</p>
  
  <p>Daniel</p>
  
  <p><em>edit1</em>: I have initialized a Keyspace with replication class SimpleStrategy and factor 3 - I read somewere, that the number should not exceed the number of nodes (I guess it was somewhere in the docu, but I don't have the link anymore)... Can this be a reason?</p>