0

使用当前 GA 版本 1.2.1 时出现以下异常。存储库对象在我的示例代码中自动装配。

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cassandraTemplate' defined in class path resource [com/vmware/vrack/CassandraConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.core.CassandraAdminOperations]: Factory method 'cassandraTemplate' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/cassandra/core/Cancellable
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 37 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.core.CassandraAdminOperations]: Factory method 'cassandraTemplate' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/cassandra/core/Cancellable
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 46 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/cassandra/core/Cancellable
    at org.springframework.data.cassandra.config.java.AbstractCassandraConfiguration.cassandraTemplate(AbstractCassandraConfiguration.java:85)
    at mine.samples.CassandraConfiguration$$EnhancerBySpringCGLIB$$831105a6.CGLIB$cassandraTemplate$5(<generated>)
    at mine.samples.CassandraConfiguration$$EnhancerBySpringCGLIB$$831105a6$$FastClassBySpringCGLIB$$2a9e6652.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at mine.samples.CassandraConfiguration$$EnhancerBySpringCGLIB$$831105a6.cassandraTemplate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: org.springframework.cassandra.core.Cancellable
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:136)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 58 more

是否有解决方法或解决方法?

4

2 回答 2

1

After much snooping around I found out that the issue was due to an older version of spring-cql being used.

I fixed it by using dependency management to explicitly use the latest spring-cql version. Add this to your pom.xml:

<dependencyManagement>
      <dependencies>
    <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-cql</artifactId>
          <version>1.2.1.RELEASE</version>
    </dependency>
      </dependencies>
    </dependencyManagement>
于 2015-07-11T02:36:04.810 回答
0

spring-data-cassandra 1.1.3 版本没有这个问题。如果你只需要让事情运行,你可以切换回那个。

(我也在关注这个问题,看看它是否得到解决。)

于 2015-07-09T20:47:33.033 回答