cassandra错误键空间不存在

时间:2016-12-17 01:07:57

标签: ubuntu docker cassandra

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JournalActions': Invocation of init method failed; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Keyspace 'audit' does not exist
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
    at com.paypal.pps.activity.init.RaptorApplication.main(RaptorApplication.java:23)
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Keyspace 'audit' does not exist

但是当我手动登录cqlsh时,我能够选择该表。

  

cqlsh:期刊GT;使用审计;

     

cqlsh:审计> select * from event_log;

     

event_id | EVENT_TYPE

我正在使用在docker上运行的Cassandra 3.9

1 个答案:

答案 0 :(得分:2)

您已经缩小了问题范围(在cqlsh中查询正在运行), 所以问题出在司机方面。

请确保以下

1)使用的驱动程序(datastax.cassandra - cassandra-driver-core - 版本3.0.0-alpha5)与Cassandra数据库版本兼容

2)如果项目中有任何spring-data-cassandra库参考,请删除

请参阅这些帖子了解更多信息

https://docs.datastax.com/en/developer/driver-matrix/doc/javaDrivers.html#java-drivers

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces