我试着在Cassandra 2.1.12上使用spring-data-cassandra 1.3.4和最新的cassandra-driver-core:3.0.(DSE4.8.4的一部分),结果一切正常。同样的spring批处理不能用于普通的Cassandra3.x版本。我在Cassandra 3.2、3.3和3.4上试用了它。
我得到了ClassNotFound Exception
,它在下面的堆栈跟踪中提到。
现在我完全理解了这是由于“com.datastax.driver.core.datatype.java”中不存在一个特定的方法(asJavaClass)造成的。
我的问题是,有没有别的办法可以绕过这件事?
我正在使用spring批处理做一次数据加载,这是巨大的。我不能用比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驱动程序兼容性图表),您将看到需要3.x客户机驱动程序才能使用Cassandra 3.x。
正如Aaron所提到的,它不是C*最好的ORM实现,因为它最初是为RDBMS接口设计的,因此它的实现是针对NoSQL数据库(如Cassandra)的反模式。
您提到这是对大量数据的一次性加载,我将首先从本文中了解将大量数据加载到Cassandra的最佳方法(提示不要使用批处理)。我不知道有什么真正好的工具可以进行数据迁移(这也取决于您的源系统是什么)。所以你可能需要写一些自定义的东西,或者改编一些东西。
我正在尝试使用Cassandra 2.1升级到Spring Data Cassandra 1.5. x的Spring Boot 1.5,但出现启动错误: 未能实例化[org.springframework.data.cassandra.mapping.CassandraMappingContext]:工厂方法“cassandraMapping”引发异常;嵌套异常为java.lang.NoClass
我已经试着解决这个问题好几天了,我在论坛上也找不到任何有类似问题的帖子。当我将servlet映射url模式设置为*时,Spring主题运行良好。web中的html。xml文件。但是,如果我更改web中的url模式。将xml文件改为正斜杠,以便默认servlet处理所有请求,并且URL可以看起来像REST URL,然后我使用它来获得无映射错误,这导致无法显示网页的css设置。我用来获取的无映射警告如
我想看看Spring Boot2和GraphQL。我的pom.xml看起来是: 使用graphql进行Spring Boot的graphql演示项目 当我开始这个项目时,它运行正常。然后我想查看graphiql站点,并放一些查询以供测试。但是在我的IDE的控制台中有一个异常,模式没有加载到GraphiQL-Page上。
Spring启动版本 1.5.x 可以与 Java 11 一起使用吗?还是有必要将其移至2.1.x春节?
我在使用SpringWebService和SpringFramework4.3时收到以下错误。15个版本罐。 spring-ws-2.1。2.全部释放。jarspring-ws-core-2.2。2.释放。罐子 您能告诉我如何解决这个问题吗?我需要升级SpringWS-JAR还是降低SpringFramework版本。 原因:java。lang.NoSuchMethodError:org。spri
不知道Spring Data Elasticsearch 3.0.6支持哪个版本的Elasticsearch? 目前我正在使用Elasticsearch 6.2,这兼容吗?现在我正在使用Elasticsearch Rest Client进行Java,但是由于我使用的是Spring,所以我考虑使用Spring Data Elasticsearch。