Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring not able to connect with cassandra running on docker #26

Open
abcool opened this issue Feb 4, 2024 · 1 comment
Open

Spring not able to connect with cassandra running on docker #26

abcool opened this issue Feb 4, 2024 · 1 comment

Comments

@abcool
Copy link

abcool commented Feb 4, 2024

Caused by: java.lang.IllegalStateException: 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=09137d7d-bd7e-46b2-a3d3-fe350c30b5a9, hashCode=69f9f10a)=datacenter1. Current DCs in this cluster are: datacenter1

Application.yml

spring:
thymeleaf:
cache: true
data:
cassandra:
keyspace-name: taco_cloud
schema-action: CREATE_IF_NOT_EXISTS
local-datacenter: datacenter1
contact-points: localhost
port: 9042

root@15541c9a703e:/# nodetool status
Datacenter: datacenter1

cqlsh> desc keyspaces;

system system_distributed system_traces system_virtual_schema
system_auth system_schema system_views taco_cloud

Github repo url: https://github.com/abcool/Training/tree/master/Spring%20in%20Action/Taco%20Cloud/Chapter-4

@MykhailoShekera
Copy link

Starting with Spring Boot 3.0, the prefix for Cassandra properties has changed from spring.data.cassandra.* to spring.cassandra.*: https://stackoverflow.com/questions/60668792/spring-data-with-cassandra-giving-illegalstateexception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants