When I tried to use @Bean in spring boot to create CqlSession, I got the following error message. The core driver version used is 4.4.0;
@Configuration public class CassandraConfig { @Bean public CqlSession cqlSession() { return CqlSession.builder() .addContactPoint(new InetSocketAddress(contactPoints, port)) .withKeyspace(keyspace()) .withSslContext(createSslContextWithTruststore()) .withAuthCredentials(username, password) .withLocalDatacenter("DEVoce-DC2") .build(); } }
LN="o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext" MSG=Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cqlSession' defined in class path resource [*/CassandraConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.datastax.oss.driver.api.core.CqlSession]: Factory method 'cqlSession' threw exception; nested exception is java.lang.NoSuchMethodError: com.datastax.oss.protocol.internal.request.query.QueryOptions.<init>(ILjava/util/List;Ljava/util/Map;ZILjava/nio/ByteBuffer;IJLjava/lang/String;)V