Using Cassandra 3.x driver with Spring Boot

The question is related to the use of Cassandra driver 3.6.0 and Guava 19.0, and the occurrence of an exception. Despite downgrading from Cassandra Core driver 20 to 19, the issue persists when connecting to the cluster from the client code. The Java Driver is included in the pom.xml snippet. The solution to the problem is not related to the Guava version. Instead, upgrading to Cassandra driver version 3.11.0 is the recommended solution, as the paraphraser had a similar issue and found this to be the best solution.

Question:

For my operations, I utilize
Spring Boot
and

1.3.8.RELEASE

. In order to implement the Cassandra 3.x driver, I experimented with a method similar to the following:

    
        org.springframework.boot
        spring-boot-starter-data-cassandra
        
            
                org.springframework.data
                spring-data-cassandra
            
        
    
    
        org.springframework.data
        spring-data-cassandra
        1.4.0.RELEASE
        
            
                com.datastax.cassandra
                cassandra-driver-core
            
            
                com.datastax.cassandra
                cassandra-driver-dse
            
        
    
    
    
        com.datastax.cassandra
        cassandra-driver-core
        3.1.0
    

But i get error;

Caused by: java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
at org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.(CassandraSimpleTypeHolder.java:62) ~[spring-data-cassandra-1.4.0.RELEASE.jar:?]

I gave it a shot after coming across a post at https://github.com/spring-projects/
spring-boot
/issues/5835.

There are no breaking changes for Spring Boot when adopting the Cassandra 3 changes in Spring Data Cassandra 1.5 (Ingalls). The upgrade has been tested with both Boot 1.3.3 and 1.4.0-SNAPSHOT.

Shouldn’t it be as mentioned earlier?
Where have I made a mistake?

Please note that I attempted to execute the sample provided in this GitHub repository: https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-
data-cassandra


Solution:

The version 1.4.0.RELEASE of spring-data-cassandra relies on two dependencies, namely

<cassandra.version>2.1.11</cassandra.version>

and

<cassandra-driver-dse.version>2.1.7.1</cassandra-driver-dse.version>

. Additional information can be found on the following GitHub page: https://github.com/spring-
projects/spring-data
-cassandra/blob/1.4.0.RELEASE/pom.xml.

To take advantage of
spring-boot-starter-data-cassandra
that relies on both

<cassandra.version>3.0.0</cassandra.version>

and

<cassandra-driver.version>3.0.3</cassandra-driver.version>

, it is recommended to upgrade to spring-boot 1.5.x if you plan on using Cassandra 3.x. For more information, please refer to the following link: https://github.com/spring-projects/spring-data-cassandra/blob/1.5.0.M1/pom.xml.

Eliminate the need for Cassandra driver inclusion in the pom file, as the correct version will be supplied by Spring Boot.

Frequently Asked Questions