I'm trying to connect to amazon-keyspace AWS Casandra via my spring-boot-3 multi-module software but it tries to connect localhost / endPoint=/127.0.0.1:9042 instead. here is some of my build gradle
plugins {
java
id("org.springframework.boot") version "3.0.1" apply false
id("io.spring.dependency-management") version "1.1.0"
id("io.freefair.lombok") version "6.6.1"
}
java.sourceCompatibility = JavaVersion.VERSION_17
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-cassandra-reactive")
implementation("software.aws.mcs:aws-sigv4-auth-cassandra-java-driver-plugin:4.0.8")
...
}
try diffrent application.yml file and add and remove some settings to see diffrence
`
#new settings
spring:
cassandra:
keyspace-name: my-existing-keyspace
schema-action: none
config: keyspaces-application.conf
local-datacenter: eu-north-1
contact-points: cassandra.eu-north-1.amazonaws.com:9142
#Depricated one
spring:
data:
cassandra:
keyspace-name: my-existing-keyspace
schema-action: none
config: keyspaces-application.conf
local-datacenter: eu-north-1
contact-points: cassandra.eu-north-1.amazonaws.com:9142`
and here it is my keyspaces-application.conf :
datastax-java-driver {
basic.contact-points = [ "cassandra.eu-north-1.amazonaws.com:9142"]
advanced.auth-provider{
class = PlainTextAuthProvider
username = "my existing username"
type here
password = "my existing password"
}
basic.load-balancing-policy {
local-datacenter = "eu-north-1"
slow-replica-avoidance = false
}
advanced.ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = "/home/ec2-user/cassandra_truststore.jks"
truststore-password = "my-truststore-password"
hostname-validation = false
}
}
but it tries to connect localhost 1
and here it is some logs:
`Error connecting to Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=3d061dd6), trying next node (ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (io.netty.channel.StacklessClosedChannelException))
WARN 24461 --- [ main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myRepositoryImpl' defined in URL [jar:file:/home/ec2-user/my-service/my-container/build/libs/my-container-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/my-dataaccess-0.0.1-SNAPSHOT.jar!/com/anything/MyRepositoryImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'myCasandraRepository' defined in ******.MyRepository defined in @EnableReactiveCassandraRepositories declared on ContainerApplication: Cannot resolve reference to bean 'reactiveCassandraTemplate' while setting bean property 'reactiveCassandraOperations'`
`Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reactiveCassandraTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveCassandraTemplate' parameter 0: Error creating bean with name 'reactiveCassandraSession' defined in class path resource [org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveCassandraSession' parameter 0: Error creating bean with name 'cassandraSession' defined in class path resource [org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.class]: Failed to instantiate [com.datastax.oss.driver.api.core.CqlSession]: Factory method 'cassandraSession' threw exception with message: Could not reach any contact point, make sure you've provided valid addresses (showing first 1 nodes, use getAllError`
`Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cassandraSession' defined in class path resource [org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.class]: Failed to instantiate [com.datastax.oss.driver.api.core.CqlSession]: Factory method 'cassandraSession' threw exception with message: Could not reach any contact point, make sure you've provided valid addresses (showing first 1 nodes, use getAllErrors() for more): Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=3d061dd6): [com.datastax.oss.driver.api.core.connection.ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (io.netty.channel.StacklessClosedChannelException)]`
I am trying to connect amazon-keyspace aws casandra via spring boot 3 application and datastax-v4 but it try to connect to localhost endPoint=/127.0.0.1:9042 It should be posibbly I missed a config or may some config changed for spring boot 3 or need some changes for reactive settings