Reputation: 3876
I have this code:
private final String CONTACT_POINT = "127.0.0.1";
private SynchronizationTableManager()
{
cluster = Cluster.builder().addContactPoint(CONTACT_POINT).build();;
session = cluster.connect(KEYSPACE);
createTableIfNotExists();
}
I get the following exception:
All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect)) with stack trace: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
This happens on the line calling cluster.connect(KEYSPACE)
. Any idea how to fix this?
Upvotes: 2
Views: 10284
Reputation: 4819
I have faced same exception when i connect from my local machine to cassandra cluster using ssl certificate.
For my case, Java version giving some problem. I was using java 1.80_91 which is little bit older version. After that i updated my java version to 1.8.0_221. That is work for me.
This may helpful ,someone in the same boat.
Upvotes: 0
Reputation: 261
This is most likely a problem with cassandra.yaml settings. Please check the settings of listen_address, rpc_address, and broadcast_rpc_address.
Please also check the connection requirements for the Java driver: https://github.com/datastax/java-driver/wiki/Connection-requirements
Also what does nodetool ring tell you about your C* node? Can you connect to your node over cqlsh?
Upvotes: 3