2

I have a Java Spring app and I'm using Amazon Keyspaces (for Apache Cassandra). I'm using the sigv4 plugin , (version 4.0.2), the cassandra java-driver-core (version 4.4.0) and have followed the official documentation on how to connect my java app with MCS. The app connects just fine but I'm getting a weird warning at start up:

WARN 1 --- [     s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.

Everything looks good but after a few minutes that warning comes back and my queries start to fail. This is how the logs look after a few minutes:

WARN 1 --- [     s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.
WARN 1 --- [        s0-io-1] c.d.o.d.i.c.m.SchemaAgreementChecker     : [s0] Unknown peer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, excluding from schema agreement check
WARN 1 --- [        s0-io-0] c.d.o.d.i.c.control.ControlConnection    : [s0] Unexpected error while refreshing schema after a successful reconnection, keeping previous version (CompletionException: com.datastax.oss.driver.api.core.connection.ClosedConnectionException: Channel was force-closed)
WARN 1 --- [        s0-io-1] c.d.o.d.i.c.m.DefaultTopologyMonitor     : [s0] Control node ec2-x-xx-xxx-xx.us-east-2.compute.amazonaws.com/x.xx.xxx.xxx:xxxx has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.

I have debugged a little and it looks like that partitioner comes from the actual node metadata, so I don't really know if there's an actual way to fix it.

I've seen there's a similar question asked recently here, but no solution has been posted yet. Any ideas? Thanks so much in advance

GD9
  • 23
  • 4
  • No required implementation was provided by Amazon to official driver, so no such solution exists... Maybe they publish drivers somewhere on their site? – Alex Ott May 03 '20 at 08:41
  • @AlexOtt thanks for your reply. The aws plugin required to connect to AWS MCS (now AWS Keyspaces) [uses the datastax java plugin](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin/blob/master/pom.xml#L55). So unfortunately I don't think there's an alternative right now. – GD9 May 08 '20 at 02:02

2 Answers2

2

These are all warnings and not errors. Your connection should work just fine. They are logged due to how Amazon Keyspaces is slightly different from an actual Cassandra cluster. Try setting these to get rid of the noise:

datastax-java-driver.advanced {
  metadata {
    schema.enabled = false
    token-map.enabled = false
  }
  connection.warn-on-init-error = false
}
antex
  • 794
  • 7
  • 8
1

Problem the same with me.

enter image description here

The above problems encountered when using a Spring boot version 2.3.x

Because is a Spring boot version 2.3.x

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-cassandra-reactive</artifactId>
</dependency>

OR

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency> 

When creating a Maven / Gradle will get "datastax-java-driver-core 4.6.1" and I think this is another reason that Amazon Keyspaces are not supported.

enter image description here

Okay, Clear.....

Back to the subject of AWS library aws-sigv4-auth-cassandra-java-driver-plugin 4.0.2

When creating a Maven / Gradle will get "datastax-java-driver-core 4.4.0"

enter image description here

Now I am starting to see that Amazon Keyspaces

Maybe not supported "datastax-java-driver-core" with version greater than 4.4.0

Okay, it's been very long.

If you want Application Spring Boot 2 to work

You try following the solutions follows.

look at pom.xml

  1. remove aws-sigv4-auth-cassandra-java-driver-plugin

  2. downgrade Spring boot version 2.3.x to 2.2.9

  3. add dependency below,

spring-boot-starter-data-cassandra-reactive OR spring-boot-starter-data-cassandra

  1. create Amazon digital certificate and download

  2. If you used InteljiJ IDEA Edit Configurations

enter image description here

Goto Edit Configurations -> next VM Options add below,

-Djavax.net.ssl.trustStore=path_to_file/cassandra_truststore.jks 

-Djavax.net.ssl.trustStorePassword=my_password

enter image description here

Reference: https://docs.aws.amazon.com/keyspaces/latest/devguide/using_java_driver.html

  1. application-dev.yml add config below,
spring:
      data:
        cassandra:
          contact-points:
            - "cassandra.ap-southeast-1.amazonaws.com"
          port: 9142
          ssl: true
          username: "cassandra-username"
          password: "cassandra-password"
          keyspace-name: keyspace-name
          request:
            consistency: local_quorum
  1. Run Test Program

enter image description here enter image description here

Pass.

Work for me.

Tech Stack

  • Spring Boot WebFlux 2.2.9.RELEASE
  • Cassandra Reactive
  • JDK 13
  • Cassandra Database with Amazon Keyspaces
  • Maven 3.6.3

Have fun with programming.

bamossza
  • 3,676
  • 1
  • 29
  • 28
  • 1
    Thanks so much for your answer. Going back to a previous version of Spring Cassandra did the trick! – GD9 Aug 20 '20 at 01:04