I am trying to connect Cassandra with Java under Windows Environment. Following are application/OS/lib version.
-Windows 7
-Java 7
-Cassandra 2.1.12
Code:
Cluster clst;
Session ses;
clst= Cluster.builder().addContactPoint("127.0.0.1").withPort(9042).build();
Cassandra and nodetool is running. Below is the status of nodetool.
C:\Program Files\DataStax Community\apache-cassandra\bin>nodetool -h localhost status
Starting NodeTool
Datacenter: datacenter1
========================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 127.0.0.1 245.99 KB 256 ? 61c6b0e5-2f83-4bc9-9b86-6507e2f06dfc rack1
Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless
C:\Program Files\DataStax Community\apache-cassandra\bin>
When I am trying to connect cassandra with localhost/127.0.01 I and getting below error in stacktrace.
19:19:05.996 [main] DEBUG c.d.driver.core.ControlConnection - [Control connection] Refreshing node list and token map
19:19:06.465 [main] DEBUG c.d.driver.core.ControlConnection - [Control connection] error on /127.0.0.1 connection (com.datastax.driver.core.TransportException: [/127.0.0.1] Unexpected exception triggered), no more host to try
19:19:06.469 [main] DEBUG com.datastax.driver.core.Cluster - Shutting down
Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: [/127.0.0.1])
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:162)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:83)
at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:516)
at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:473)
at com.datastax.driver.core.Cluster.<init>(Cluster.java:65)
at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:93)
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:458)
at cass.Cass.main(Cass.java:16)
Java Result: 1
Also I have tried to find out the solution on stackoverflow also on another sites but got failed to solve my issue.
Does anybody have the some solution for this query?