1
[s0] Authentication error (AuthenticationException: Authentication error on node cdbd07ee-81fe-4adf-85e4-34338172ad24-asia-south1.db.astra.datastax.com/<unresolved>:29042:087b610b-271c-4e87-940d-65f26a2875be: \
  Node cdbd07ee-81fe-4adf-85e4-34338172ad24-asia-south1.db.astra.datastax.com/<unresolved>:29042:087b610b-271c-4e87-940d-65f26a2875be \
    requires authentication (org.apache.cassandra.auth.PasswordAuthenticator), \
    but no authenticator configured)

This is the application.yml file.

spring:
  data:
    cassandra:
      keyspace-name: main
      username: FSvHWqiJPhyZLptJoLUNo
      password: ********
      schema-action: create-if-not-exists
      request:
        timeout: 10s
      connection:
        connect-timeout: 10s
        init-query-timeout: 10s

datastax.astra:
  secure-connect-bundle: secure-connect.zip

astra.db:
  id: cdbd07ee-81fe-4adf-172ad24-1
  region: asia-south1
  keyspace: main
  application.token: AstraCS:*****:*****
Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Ayan Paul
  • 11
  • 2

1 Answers1

2

You need to customize the CqlSession by adding the secure connect bundle. With Spring Data you use a CqlSessionBuilderCustomizer as follow :

1/ Create a Bean to receive your property datastax.astra

@ConfigurationProperties(prefix = "datastax.astra")
public class DataStaxAstraProperties {
    private File secureConnectBundle;
    //getter and setters.
}

2/ Use this bean to customize this session

@Bean
public CqlSessionBuilderCustomizer sessionBuilderCustomizer(DataStaxAstraProperties astraProperties) {
    Path bundle = astraProperties.getSecureConnectBundle().toPath();
    return builder -> builder.withCloudSecureConnectBundle(bundle);
}

Here is a working sample:

You might be interested in the Astra Spring Boot Starter:

clunven
  • 1,360
  • 6
  • 13