gpt4 book ai didi

cassandra - Spring-data-cassandra 1.3.4 与 Cassandra 3.x 不兼容

转载 作者:行者123 更新时间:2023-12-03 01:26:39 29 4
gpt4 key购买 nike

我尝试在 Cassandra 2.1.12(作为 DSE 4.8.4 的一部分)上使用 Spring-data-cassandra 1.3.4 以及最新的 cassandra-driver-core 3.0.0,一切正常。因为相同的 spring 批处理不适用于普通的 Cassandra 3.x 版本。我在 Cassandra 3.2、3.3 和 3.4 上尝试过。

我收到以下堆栈跟踪中提到的ClassNotFound Exception

现在我完全明白这是由于“com.datastax.driver.core.DataType.java”中不存在特定方法(asJavaClass)造成的。

我的问题是有没有其他方法可以解决这个问题?

我正在使用 Spring Batch 进行一次性数据加载,这是巨大的。而且我不能使用低于 Cassandra 3.3 的任何东西。

2016-04-11 13:38:32.684  WARN 3166 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingContext' defined in class path resource [com/walgreens/batch/config/CassandraConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.mapping.CassandraMappingContext]: Factory method 'mappingContext' threw exception; nested exception is java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
2016-04-11 13:38:32.808 ERROR 3166 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingContext' defined in class path resource [com/walgreens/batch/config/CassandraConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.mapping.CassandraMappingContext]: Factory method 'mappingContext' threw exception; nested exception is java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at com.walgreens.batch.WagStoreInventoryBatchJobApplication.main(WagStoreInventoryBatchJobApplication.java:43) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.mapping.CassandraMappingContext]: Factory method 'mappingContext' threw exception; nested exception is java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 17 common frames omitted
Caused by: java.lang.NoSuchMethodError: com.datastax.driver.core.DataType.asJavaClass()Ljava/lang/Class;
at org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.<clinit>(CassandraSimpleTypeHolder.java:62) ~[spring-data-cassandra-1.3.4.RELEASE.jar:na]
at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.<init>(BasicCassandraMappingContext.java:73) ~[spring-data-cassandra-1.3.4.RELEASE.jar:na]
at com.walgreens.batch.config.CassandraConfiguration.mappingContext(CassandraConfiguration.java:47) ~[classes/:na]
at com.walgreens.batch.config.CassandraConfiguration$$EnhancerBySpringCGLIB$$78a36265.CGLIB$mappingContext$4(<generated>) ~[classes/:na]
at com.walgreens.batch.config.CassandraConfiguration$$EnhancerBySpringCGLIB$$78a36265$$FastClassBySpringCGLIB$$c7f2ad2a.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at com.walgreens.batch.config.CassandraConfiguration$$EnhancerBySpringCGLIB$$78a36265.mappingContext(<generated>) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 18 common frames omitted

2016-04-11 13:38:32.811 INFO 3166 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/Users/Siraj/Documents/workspace/Ask2/WagStoreInventoryBatchJob/target/classes/, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter-batch/1.3.3.RELEASE/spring-boot-starter-batch-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.3.RELEASE/spring-boot-starter-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot/1.3.3.RELEASE/spring-boot-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.3.RELEASE/spring-boot-starter-logging-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/ch/qos/logback/logback-classic/1.1.5/logback-classic-1.1.5.jar, file:/Users/Siraj/.m2/repository/ch/qos/logback/logback-core/1.1.5/logback-core-1.1.5.jar, file:/Users/Siraj/.m2/repository/org/slf4j/jul-to-slf4j/1.7.16/jul-to-slf4j-1.7.16.jar, file:/Users/Siraj/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.16/log4j-over-slf4j-1.7.16.jar, file:/Users/Siraj/.m2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/Users/Siraj/.m2/repository/org/hsqldb/hsqldb/2.3.3/hsqldb-2.3.3.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-jdbc/4.2.5.RELEASE/spring-jdbc-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/batch/spring-batch-core/3.0.6.RELEASE/spring-batch-core-3.0.6.RELEASE.jar, file:/Users/Siraj/.m2/repository/com/ibm/jbatch/com.ibm.jbatch-tck-spi/1.0/com.ibm.jbatch-tck-spi-1.0.jar, file:/Users/Siraj/.m2/repository/javax/batch/javax.batch-api/1.0/javax.batch-api-1.0.jar, file:/Users/Siraj/.m2/repository/com/thoughtworks/xstream/xstream/1.4.7/xstream-1.4.7.jar, file:/Users/Siraj/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/Users/Siraj/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/Users/Siraj/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar, file:/Users/Siraj/.m2/repository/org/springframework/batch/spring-batch-infrastructure/3.0.6.RELEASE/spring-batch-infrastructure-3.0.6.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/retry/spring-retry/1.1.2.RELEASE/spring-retry-1.1.2.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter-data-cassandra/1.3.3.RELEASE/spring-boot-starter-data-cassandra-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-tx/4.2.5.RELEASE/spring-tx-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/data/spring-data-cassandra/1.3.4.RELEASE/spring-data-cassandra-1.3.4.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/data/spring-cql/1.3.4.RELEASE/spring-cql-1.3.4.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/data/spring-data-commons/1.11.4.RELEASE/spring-data-commons-1.11.4.RELEASE.jar, file:/Users/Siraj/.m2/repository/com/datastax/cassandra/cassandra-driver-dse/2.1.9/cassandra-driver-dse-2.1.9.jar, file:/Users/Siraj/.m2/repository/org/slf4j/slf4j-api/1.7.16/slf4j-api-1.7.16.jar, file:/Users/Siraj/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.16/jcl-over-slf4j-1.7.16.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.3.3.RELEASE/spring-boot-starter-jdbc-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.32/tomcat-jdbc-8.0.32.jar, file:/Users/Siraj/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.32/tomcat-juli-8.0.32.jar, file:/Users/Siraj/.m2/repository/com/datastax/cassandra/cassandra-driver-core/3.0.0/cassandra-driver-core-3.0.0.jar, file:/Users/Siraj/.m2/repository/io/netty/netty-handler/4.0.33.Final/netty-handler-4.0.33.Final.jar, file:/Users/Siraj/.m2/repository/io/netty/netty-buffer/4.0.33.Final/netty-buffer-4.0.33.Final.jar, file:/Users/Siraj/.m2/repository/io/netty/netty-common/4.0.33.Final/netty-common-4.0.33.Final.jar, file:/Users/Siraj/.m2/repository/io/netty/netty-transport/4.0.33.Final/netty-transport-4.0.33.Final.jar, file:/Users/Siraj/.m2/repository/io/netty/netty-codec/4.0.33.Final/netty-codec-4.0.33.Final.jar, file:/Users/Siraj/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar, file:/Users/Siraj/.m2/repository/io/dropwizard/metrics/metrics-core/3.1.2/metrics-core-3.1.2.jar, file:/Users/Siraj/.m2/repository/joda-time/joda-time/2.8.2/joda-time-2.8.2.jar, file:/Users/Siraj/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-configuration-processor/1.3.3.RELEASE/spring-boot-configuration-processor-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/json/json/20140107/json-20140107.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.3.3.RELEASE/spring-boot-starter-aop-1.3.3.RELEASE.jar, file:/Users/Siraj/.m2/repository/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar, file:/Users/Siraj/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/Users/Siraj/.m2/repository/org/aspectj/aspectjweaver/1.8.8/aspectjweaver-1.8.8.jar, file:/Users/Siraj/.m2/repository/com/oracle/ojdbc6/11.2.0.4/ojdbc6-11.2.0.4.jar]

最佳答案

Spring-Data-Cassandra 1.3.4(甚至最新的开发版本)使用客户端驱动程序 Cassandra 2.1.x请参阅 Datastax 驱动程序 compatibility chart您会发现需要 3.x 客户端驱动程序才能使用 Cassandra 3.x 。

正如 Aaron 所提到的,这不是 C* 的最佳 ORM 实现,因为它最初是为 RDBMS 接口(interface)设计的,因此具有与 Cassandra 等 NoSQL 数据库反模式的实现。

您提到这是大量数据的一次性数据加载,我会首先阅读有关将大量数据加载到 Cassandra from this article 的最佳方法。 (提示不要使用批处理)。我不知道有什么真正好的工具可以进行开箱即用的数据迁移(也取决于您的源系统是什么)。因此,您可能必须编写一些自定义的内容,或者进行一些调整。

关于cassandra - Spring-data-cassandra 1.3.4 与 Cassandra 3.x 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36558099/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com