升级到 Finchley.RELEASE 后 Cassandra 不工作
Cassandra not working after upgrading to Finchley.RELEASE
PFB 错误详细信息。
由以下原因引起:
org.springframework.beans.factory.BeanCreationException:创建名称为 'session' 的 bean 在 class 路径资源 [com/walgreens/coupons/config/CommonConfig.class] 中定义时出错:通过工厂方法实例化 Bean 失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化 [org.springframework.data.cassandra.config.CassandraSessionFactoryBean]:工厂方法 'session' 抛出异常;嵌套异常是 org.springframework.beans.factory.BeanCreationException:在 class 路径资源 [com/walgreens/coupons/config/CommonConfig.class] 中定义名称 'cluster' 创建 bean 时出错:调用 init 方法失败;嵌套异常是 java.lang.NoClassDefFoundError:无法初始化 class com.datastax.driver.core.Cluster
build.gradle
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import java.text.SimpleDateFormat;
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext
{ springBootVersion = '2.0.1.RELEASE' }
{{dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath ("com.bmuschko:gradle-docker-plugin:3.2.1")
classpath ("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5")
classpath("au.com.dius:pact-jvm-provider-gradle_2.12:3.5.13")
classpath ("com.moowork.gradle:gradle-node-plugin:1.2.0")
}}}
}
plugins
{ //id "au.com.dius.pact" version "3.5.7" id "com.gorylenko.gradle-git-properties" version "1.4.17" id "de.undercouch.download" version "3.4.2" }
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.bmuschko.docker-remote-api'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'org.sonarqube'
apply plugin: 'au.com.dius.pact'
apply plugin: 'scala'
sourceCompatibility = 1.8
ext
{ springCloudVersion = 'Finchley.RELEASE' }
pact {
serviceProviders {
rxorder {
publish
{ pactDirectory = '/Users/sv/Documents/doccc/target/pacts' // defaults to $buildDir/pacts pactBrokerUrl = '[http://localhost:80|http://localhost/]' version=2.0 }
}
}
}
//start of integration tests changes
sourceSets {
integrationTest {
java
{ compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output srcDir file('test/functional-api/java') }
resources.srcDir file('test/functional-api/resources')
}
}
configurations
{ integrationTestCompile.extendsFrom testCompile integrationTestRuntime.extendsFrom testRuntime }
//end of integration tests changes
dependencies {
//web (Tomcat, Logging, Rest)
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
// Redis
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
//Mongo Starter
compile group: 'org.springframework.boot', name:'spring-boot-starter-data-mongodb'
{{// Configuration processor - To Generate MetaData Files. The files are designed to let developers offer “code completion� as users are working with application.properties
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
// Actuator - Monitoring
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
//Sleuth - Tracing
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth'
//Hystrix - Circuit Breaker
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix'
// Hystrix - Dashboard
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix-dashboard'
// Thymeleaf
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
//Voltage
// Device Detection
//compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.3.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-cassandra', version:'1.5.12.RELEASE'
compile('com.google.code.gson:gson:2.8.0')
compile('org.json:json:20170516')
//Swagger
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.8.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.8.0'
//Lombok
compileOnly group: 'org.projectlombok', name: 'lombok'
compile group: 'io.smartcat', name: 'cassandra-diagnostics-connector21', version: '1.4.10'
//Testing
//Spring WS Test
testCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE'
testCompile('org.springframework.boot:spring-boot-starter-test')
{ exclude group: "com.vaadin.external.google", module:"android-json" }
//Pact
testCompile group: 'au.com.dius', name: 'pact-jvm-provider-gradle_2.12', version: '3.5.7'
testCompile group: 'au.com.dius', name:'pact-jvm-provider-junit_2.12',version:'3.5.13'
testCompile group: 'au.com.dius', name:'pact-jvm-consumer-junit_2.12', version:'3.5.13'
//Embedded mongo for testing
testCompile group: 'de.flapdoodle.embed', name:'de.flapdoodle.embed.mongo',version:'2.0.1'
//testCompile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.1'
compile group: 'info.cukes', name: 'cucumber-jvm', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5'
testCompile('org.cassandraunit:cassandra-unit-spring:3.5.0.1')
{ exclude group: 'org.cassandraunit', module: 'cassandra-unit' }
// https://mvnrepository.com/artifact/org.cassandraunit/cassandra-unit-shaded
compile group: 'org.cassandraunit', name: 'cassandra-unit-shaded', version: '3.5.0.1'
// https://mvnrepository.com/artifact/org.hectorclient/hector-core
compile group: 'org.hectorclient', name: 'hector-core', version: '2.0-0'
integrationTestCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE' //changes for integration tests
integrationTestCompile("org.springframework.boot:spring-boot-starter-test")
{ //changes for integration tests exclude group: "com.vaadin.external.google", module:"android-json" }
integrationTestCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5' //changes for integration tests
integrationTestCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5' //changes for integration tests}}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
感谢大家的帮助。我们能够通过单独添加以下依赖项来解决问题。
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
compile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.11.3'
PFB 错误详细信息。 由以下原因引起: org.springframework.beans.factory.BeanCreationException:创建名称为 'session' 的 bean 在 class 路径资源 [com/walgreens/coupons/config/CommonConfig.class] 中定义时出错:通过工厂方法实例化 Bean 失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化 [org.springframework.data.cassandra.config.CassandraSessionFactoryBean]:工厂方法 'session' 抛出异常;嵌套异常是 org.springframework.beans.factory.BeanCreationException:在 class 路径资源 [com/walgreens/coupons/config/CommonConfig.class] 中定义名称 'cluster' 创建 bean 时出错:调用 init 方法失败;嵌套异常是 java.lang.NoClassDefFoundError:无法初始化 class com.datastax.driver.core.Cluster
build.gradle
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import java.text.SimpleDateFormat;
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext
{ springBootVersion = '2.0.1.RELEASE' }
{{dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath ("com.bmuschko:gradle-docker-plugin:3.2.1")
classpath ("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5")
classpath("au.com.dius:pact-jvm-provider-gradle_2.12:3.5.13")
classpath ("com.moowork.gradle:gradle-node-plugin:1.2.0")
}}}
}
plugins
{ //id "au.com.dius.pact" version "3.5.7" id "com.gorylenko.gradle-git-properties" version "1.4.17" id "de.undercouch.download" version "3.4.2" }
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.bmuschko.docker-remote-api'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'org.sonarqube'
apply plugin: 'au.com.dius.pact'
apply plugin: 'scala'
sourceCompatibility = 1.8
ext
{ springCloudVersion = 'Finchley.RELEASE' }
pact {
serviceProviders {
rxorder {
publish
{ pactDirectory = '/Users/sv/Documents/doccc/target/pacts' // defaults to $buildDir/pacts pactBrokerUrl = '[http://localhost:80|http://localhost/]' version=2.0 }
}
}
}
//start of integration tests changes
sourceSets {
integrationTest {
java
{ compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output srcDir file('test/functional-api/java') }
resources.srcDir file('test/functional-api/resources')
}
}
configurations
{ integrationTestCompile.extendsFrom testCompile integrationTestRuntime.extendsFrom testRuntime }
//end of integration tests changes
dependencies {
//web (Tomcat, Logging, Rest)
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
// Redis
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
//Mongo Starter
compile group: 'org.springframework.boot', name:'spring-boot-starter-data-mongodb'
{{// Configuration processor - To Generate MetaData Files. The files are designed to let developers offer “code completion� as users are working with application.properties
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
// Actuator - Monitoring
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
//Sleuth - Tracing
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth'
//Hystrix - Circuit Breaker
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix'
// Hystrix - Dashboard
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix-dashboard'
// Thymeleaf
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
//Voltage
// Device Detection
//compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.3.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-cassandra', version:'1.5.12.RELEASE'
compile('com.google.code.gson:gson:2.8.0')
compile('org.json:json:20170516')
//Swagger
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.8.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.8.0'
//Lombok
compileOnly group: 'org.projectlombok', name: 'lombok'
compile group: 'io.smartcat', name: 'cassandra-diagnostics-connector21', version: '1.4.10'
//Testing
//Spring WS Test
testCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE'
testCompile('org.springframework.boot:spring-boot-starter-test')
{ exclude group: "com.vaadin.external.google", module:"android-json" }
//Pact
testCompile group: 'au.com.dius', name: 'pact-jvm-provider-gradle_2.12', version: '3.5.7'
testCompile group: 'au.com.dius', name:'pact-jvm-provider-junit_2.12',version:'3.5.13'
testCompile group: 'au.com.dius', name:'pact-jvm-consumer-junit_2.12', version:'3.5.13'
//Embedded mongo for testing
testCompile group: 'de.flapdoodle.embed', name:'de.flapdoodle.embed.mongo',version:'2.0.1'
//testCompile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.1'
compile group: 'info.cukes', name: 'cucumber-jvm', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5'
testCompile('org.cassandraunit:cassandra-unit-spring:3.5.0.1')
{ exclude group: 'org.cassandraunit', module: 'cassandra-unit' }
// https://mvnrepository.com/artifact/org.cassandraunit/cassandra-unit-shaded
compile group: 'org.cassandraunit', name: 'cassandra-unit-shaded', version: '3.5.0.1'
// https://mvnrepository.com/artifact/org.hectorclient/hector-core
compile group: 'org.hectorclient', name: 'hector-core', version: '2.0-0'
integrationTestCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE' //changes for integration tests
integrationTestCompile("org.springframework.boot:spring-boot-starter-test")
{ //changes for integration tests exclude group: "com.vaadin.external.google", module:"android-json" }
integrationTestCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5' //changes for integration tests
integrationTestCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5' //changes for integration tests}}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
感谢大家的帮助。我们能够通过单独添加以下依赖项来解决问题。
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
compile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.11.3'