java.lang.ClassNotFoundException:org.springframework.dao.QueryTimeoutException将spring-data-cassandra与spring 3.0.5集成时获取

时间:2018-11-27 09:21:36

标签: spring cassandra

java.lang.ClassNotFoundException:org.springframework.dao.QueryTimeoutException在依赖项下将spring-data-cassandra-1.5.1与spring 3.0.5集成时获取

   <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-cassandra</artifactId>
        <version>1.5.1.RELEASE</version>
    </dependency>

和“我的配置”类

@Configuration
public class CassandraUtil {

@Value("${bag.cassandra.keyspace}")     
private String KEYSPACE = "cart";

@Value("${bag.cassandra.cntactpoints}")     
private String CONTACTPOINTS = "localhost,127.0.0.1";

@Value("${bag.cassandra.port}")     
private int PORT = 9042;


@Bean
public CassandraClusterFactoryBean cluster() {
    CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean();
    cluster.setContactPoints(CONTACTPOINTS);
    cluster.setPort(PORT);
    //logger.info("CassandraUtil :: cluster, CONTACTPOINTS: {}, PORT : 
     {}",CONTACTPOINTS,PORT);
    return cluster;
}

@Bean
public CassandraMappingContext mappingContext() {
    return new BasicCassandraMappingContext();
}

@Bean
public CassandraConverter converter() {
    return new MappingCassandraConverter(mappingContext());
}

@Bean
public CassandraSessionFactoryBean session() throws Exception {
    CassandraSessionFactoryBean cassandraSessionFactoryBean = new 
 CassandraSessionFactoryBean();
    cassandraSessionFactoryBean.setCluster(cluster().getObject());
    cassandraSessionFactoryBean.setKeyspaceName(KEYSPACE);
    cassandraSessionFactoryBean.setConverter(converter());
    cassandraSessionFactoryBean.setSchemaAction(SchemaAction.NONE);
   // logger.info("CassandraUtil :: session, KEYSPACE: {}",KEYSPACE);
    return cassandraSessionFactoryBean;
}

@Bean
public CassandraOperations cassandraTemplate() throws Exception {
    return new CassandraTemplate(session().getObject());
}

}

由于版本问题,我了解到它会给出此异常,但是几乎尝试了所有版本,请提出解决此问题的更好方法。

0 个答案:

没有答案