I am trying few proof of concepts to test it for time series data. I took the sample from spring website and configured it on eclipse.
Below are few details:
Cassandra Version** - 3.0.9 Spring data cassandra version - 1.0.0.RELEASE DataStax java driver core- cassandra-driver-core-3.1.2
I am executing the below code:
Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9042).build();
Session session = cluster.connect("axiaglobal");
CassandraOperations cassandraOps = new CassandraTemplate(session);
cassandraOps.insert(new Person("1234567890", "David", 40));
and Person.java is below:
@Table
public class Person {
@PrimaryKey
private String id;
private String name;
private int age;
public Person(String id, String name, int age) {
this.id = id;
this.name = name;
this.age = age;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
@Override
public String toString() {
return "Person [id=" + id + ", name=" + name + ", age=" + age + "]";
}
}
While exeucting the code, i get the below exception:
Exception in thread "main" java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
at org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.<clinit>(CassandraSimpleTypeHolder.java:62)
at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.<init>(BasicCassandraMappingContext.java:73)
at org.springframework.data.cassandra.convert.MappingCassandraConverter.<init>(MappingCassandraConverter.java:77)
at org.springframework.data.cassandra.core.CassandraTemplate.<init>(CassandraTemplate.java:75)
at com.axia.global.dao.cassandra.service.CassandraApp.main(CassandraApp.java:26)
Can someone please help me out with the suggestions or pointers?
change pom file as below solved my issue: