0

I'm trying to connect my java spring boot application to the datastax/dse-server container with docker-compose, but I got this error: Invalid keyspace. And my cassandra service returns : cassandra-service/172.22.0.2:9042 did not send an authentication challenge; This is suspicious because the driver expects authentication. This is a part of my application.properties:

#configure Cassandra database  
spring.data.cassandra.contact-points=cassandra-service
spring.data.cassandra.cluster=***-cluster
spring.data.cassandra.keyspace-name=***
spring.data.cassandra.port=9042
spring.data.cassandra.schema-action=CREATE_IF_NOT_EXISTS
spring.data.cassandra.local-datacenter=dc1
spring.data.cassandra.rackid=rack1
spring.data.cassandra.username=***@gmail.com
spring.data.cassandra.password=*****

# Credentials to Astra DB
astra.client-id= ******
astra.client-secret= ******
astra.api.application-token=*******

# Select an Astra instance
astra.api.database-region= europe-west1
astra.api.database-id= *****
astra.api.keyspace= *****
astra.api.grpc.enabled=true
astra.cql.enabled=true
astra.cql.driver-config.basic.session-keyspace=****
# Astra DB secure connection bundle: place in resources folder
datastax.astra.auth-provider.class = PlainTextAuthProvider
datastax.astra.auth-provider.username = ***@gmail.com
datastax.astra.auth-provider.password = *****

datastax.astra.secure-connect-bundle=secure-connect-db.zip

This is a part of my docker-compose.yml:

cassandra-service:
    image: datastax/dse-server:6.8.3
    container_name: cassandra-container
    hostname: cassandra-service
    ports:
    - 9042:9042
    networks:
    - ***-network
    restart: always
    volumes:
    - ./secure-connect-clicknrate.zip:/secrets/secure-connect-clicknrate.zip
    environment:
    - DS_LICENSE=accept
    - DS_PUBLIC=1
    - DS_USERNAME=***@gmail.com
    - DS_PASSWORD=*******
    - DS_KEYSPACE=***
    - DS_SECURE_CONNECT_BUNDLE=/secrets/secure-connect-db.zip
    - CASSANDRA_CONTACT_POINTS=cassandra-service
    - CASSANDRA_KEYSPACE=****
    - CASSANDRA_PORT=9042
    - CASSANDRA_SCHEMA_ACTION=CREATE_IF_NOT_EXISTS
    - CASSANDRA_DATACENTER=dc1
    - astra.cql.driver-config.basic.session-keyspace=****

And this is a part of my pom.xml:

<!-- Cassandra Database Library -->
        <dependency>
            <groupId>com.datastax.oss</groupId>
            <artifactId>java-driver-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-cassandra</artifactId>
        </dependency>

1 Answer 1

1

It looks like you are running a DataStax Enterprise (DSE) instance:

cassandra-service:
    image: datastax/dse-server:6.8.3

but you are passing credentials for an Astra database instance:

    - DS_SECURE_CONNECT_BUNDLE=/secrets/secure-connect-db.zip

Astra credentials are not compatible with DSE and you cannot use an Astra secure-connect bundle with DSE.

In any case, the Cassandra Java driver reported the warning because you supplied a username and password but the cluster/instance you're connecting to doesn't have authentication enabled.

This is expected behaviour from the Java driver to warn you in case you have connected to the wrong cluster. Cheers!

Sign up to request clarification or add additional context in comments.

2 Comments

So what is the docker image that I must use for an astra database instance please?
Astra DB is a fully-managed Cassandra-as-a-service so by definition, there isn't a Docker image for it. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.