I try to connect app and aws cassandra, and I have an exception "No node was available to execute the query". I'm trying to work with java, Spring Data and examples from the aws. I absolutely know that I have a connection to this db but I don't know how it works and I want to point out that I've already created a keyspace. What works wrongly? How can I check the nodes? It's a little strange. I don't even know how I can solve it and my knowledge in this area is little. I even ask how and what I need to check. It's my config file.
@Configuration
public class CassandraConfig {
private final String username = "...";
private final String password = ".";
File driverConfig = new File(System.getProperty("user.dir")+"/application.conf");
@Primary
@Bean
public CqlSession session() throws NoSuchAlgorithmException {
return CqlSession.builder().
withConfigLoader(DriverConfigLoader.fromFile(driverConfig)).
withAuthCredentials(username, password).
withSslContext(SSLContext.getDefault()).
withKeyspace("my_keyspace").
build();
}
}
and another one
datastax-java-driver {
basic {
load-balancing-policy {
local-datacenter = us-east-1
}
contact-points = ["cassandra.us-east-2.amazonaws.com:9142"]
request {
page-size = 3500
timeout = 40 seconds
consistency = LOCAL_QUORUM
}
}
advanced {
control-connection {
timeout = 40 seconds
}
connection {
connect-timeout = 40 seconds
init-query-timeout = 40 seconds
}
auth-provider {
class = PlainTextAuthProvider
}
ssl-engine-factory {
class = DefaultSslEngineFactory
}
metadata {
token-map.enabled = false
schema.enabled = true
}
}
}
and exception
CassandraConnectionFailureException: Query; CQL [CREATE TABLE ............ WITH CLUSTERING ORDER BY (created DESC);]; No node was available to execute the query; nested exception is com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query