I have been dealing with this for the past 36 hours, and yet to resolve it. I added Cassandra to the Spring boot application I'm working on. The configuration of the app is as follows:
Spring boot 2.4.5, Cassandra-3.11. After much effort I followed the instruction given to add this file in the resource folder of the app - application.conf as suggested, yet the error continue to happen
Application.conf
// Add `application.conf` to your classpath with the following contents: datastax-java-driver { basic { contact-points = [ "127.0.0.1:9042"] load-balancing-policy.local-datacenter = datacenter1 } }
Spring boot dependency
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-cassandra</artifactId> </dependency>
This is my spring boot properties for Cassandra
spring.data.cassandra.contact-points=127.0.0.1 spring.data.cassandra.username=cassandra spring.data.cassandra.password=cassandra spring.data.cassandra.keyspace=accountservicedb spring.data.cassandra.port=9042 spring.data.cassandra.schema-action=CREATE_IF_NOT_EXIST spring.data.cassandra.local-datacenter=datacenter1 load-balancing-policy.local-datacenter = datacenter1
This is the crux of the error
Since you provided explicit contact points, the local DC must be explicitly set (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter). Current contact points are: Node(endPoint=/127.0.0.1:9042, hostId=c762a627-1a89-4fc0-89dc-0d8b8cccbee1, hashCode=4c83b585)=datacenter1. Current DCs in this cluster are: datacenter1
With all of the implementation of the suggested actions, nothing happened, the error continued to occur. And it seems the properties.conf file isn't picked up at all.
Please, help out. Much time has been wasted on this simple thing already. Thanks a lot.