Cassandra not working after upgrading to Finchley.RELEASE - cassandra

PFB the error details.
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [com/walgreens/coupons/config/CommonConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.config.CassandraSessionFactoryBean]: Factory method 'session' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cluster' defined in class path resource [com/walgreens/coupons/config/CommonConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize 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}"
}
}

Thanks everyone for the help. We were able to resolve the issue by adding the following dependencies separately.
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
compile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.11.3'

Related

NoClassDefFoundError: org.junit.rules.TestName in Spock 2.0:

I'm trying to update my test project from Spock 1.3 to 2.0:
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.0-groovy-2.5'
But getting the following error at the test start:
':compileTestGroovy'. Caused by: java.lang.NoClassDefFoundError: org.junit.rules.TestName
As I understand, Spock 2.0 does not contain required internal dependency with this class anymore.
I added the junit-4 dependency explicitly as it is in the Sample project:
testImplementation group: 'org.spockframework', name: 'spock-junit4', version: '2.0-groovy-2.5'
And this solved the above issue. But Now I'm getting "test events were not received" error.
Could anyone explain please what else should be changed in order to make new Spock launch the tests?
UPDATE
Adding the build.gradle. Tests have started with the below configuration:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath "io.qameta.allure:allure-gradle:2.8.1"
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.24.5'
classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE"
}
}
plugins {
id "idea"
id "groovy"
id "io.qameta.allure" version "2.5"
}
apply plugin: "application"
apply plugin: "groovy"
apply plugin: 'maven-publish'
apply plugin: 'io.qameta.allure'
sourceCompatibility = 1.8
dependencies {
compile 'org.codehaus.groovy:groovy:2.5.2'
implementation group: 'org.codehaus.groovy', name: 'groovy-dateutil', version: '2.5.2'
implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: '2.5.2'
compile "org.testng:testng:6.9.8"
compileOnly "io.micronaut:micronaut-bom:$micronautVersion"
implementation "io.micronaut:micronaut-security-jwt"
implementation "io.micronaut:micronaut-inject-groovy"
implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut:micronaut-http-server-netty"
implementation "io.micronaut:micronaut-http-client"
compile "io.micronaut:micronaut-aop"
implementation "io.micronaut:micronaut-runtime"
compile 'ch.qos.logback:logback-classic:1.1.7'
compile "org.aspectj:aspectjweaver:1.9.2"
testImplementation "io.micronaut.test:micronaut-test-spock"
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
testCompile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.0.0'
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.0-groovy-2.5'
testImplementation group: 'org.spockframework', name: 'spock-junit4', version: '2.0-groovy-2.5'
testCompile("org.gebish:geb-spock:3.4") {
/* https://github.com/micronaut-projects/micronaut-test/issues/100 */
exclude group: "org.codehaus.groovy", module: "groovy-all"
}
testCompile "org.seleniumhq.selenium:selenium-java:3.141.59"
compile "com.codeborne:selenide:4.12.0"
testCompile 'org.slf4j:slf4j-jdk14:1.7.25'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'io.qameta.allure', name: 'allure-spock', version: '2.15.0'
testCompile group: 'org.monte', name: 'screen-recorder', version: '0.7.7'
compile group: 'org.springframework', name: 'spring-messaging', version: '4.3.27.RELEASE'
compile group: 'org.springframework', name: 'spring-websocket', version: '4.3.27.RELEASE'
compile group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1'
compile group: 'org.apache.tomcat', name: 'tomcat-websocket', version: '8.0.20'
compile group: 'io.github.http-builder-ng', name: 'http-builder-ng-core', version: '1.0.4'
driver group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'
}
test {
exclude '**/*/**'
}
allure {
version = '2.15.0'
aspectjweaver = true
autoconfigure = false
resultsDir = file("$buildDir/allure-results")
reportDir = file("$buildDir/allure-report")
useSpock {
version = '2.15.0'
}
useTestNG {
version = '2.15.0'
}
}
task apiTest(type: Test, group: 'verification', dependsOn: ['fetchTestFiles']) {
outputs.upToDateWhen { false }
include '**/api/**'
getFilter().setFailOnNoMatchingTests(false)
useJUnitPlatform()
List<String> testNamePatterns = System.getProperty('API_TEST_NAME_PATTERNS')?.split(' ')?.findAll { it }
if (testNamePatterns) {
println("GOT API_TEST_FILTER PROPAGATED $testNamePatterns")
filter {
testNamePatterns.each {
includeTestsMatching(it)
}
}
}
doFirst {
def weaver = configurations.compile.find { it.name.contains("aspectjweaver") }
jvmArgs = jvmArgs << "-javaagent:$weaver"
project.gradle.startParameter.systemPropertiesArgs.entrySet().collect() {
systemProperty it.key, it.value
}
}
}
For now, I'm getting reporting error, which is not related to the initial question. Am I righ assuming that current Allure-Spock implementation does not support spock 2.0? :
org.spockframework.runtime.model.FeatureInfo.getDescription()Lorg/junit/runner/Description;
java.lang.NoSuchMethodError: org.spockframework.runtime.model.FeatureInfo.getDescription()Lorg/junit/runner/Description;
I'm guessing as you didn't provide your build.gradle, but I'm pretty sure you forgot to add
test {
useJUnitPlatform()
}

Getting Error in Databricks :Could not initialize class reactor.netty.http.client.HttpClientConfiguration

dependencies {
compile('org.apache.hadoop:hadoop-azure:3.2.1'){
exclude group: "com.google.guava", module : "guava"
}
// Azure storage dependencies
compile group: 'com.azure', name: 'azure-storage-blob', version: '12.7.0'
// HBase
compile group: 'org.apache.hbase', name: 'hbase-client', version: '1.6.0'
compile group: 'io.projectreactor', name: 'reactor-core', version: '3.3.5.RELEASE' , force: true
compile group: 'io.projectreactor.netty', name: 'reactor-netty', version: '0.9.7.RELEASE', force: true
compile group: 'io.netty', name: 'netty-transport', version: '4.1.49.Final', force: true
compile (group: 'io.netty', name: 'netty-codec-http', version: '4.1.49.Final', force: true){
exclude group: 'io.netty', module: 'netty-codec'
}
compile group: 'io.netty', name: 'netty-common', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-handler', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-resolver', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-buffer', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-transport-native-unix-common', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-codec', version: '4.1.49.Final', force: true
compile group: 'io.netty', name: 'netty-all', version: '4.1.49.Final', force: true
}
This is spark cluster dependency . I have removed netty versions. But still in databricks it fails. I checked the jar also, it contains handler.
dependencies {
// Spark dependency.
compile( group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.4.5')
{
exclude group: "io.netty", module : "netty"
exclude group: "io.netty", module : "netty-all"
}
// Spark for SQL and parquet file.
compile group: 'org.apache.spark', name: 'spark-sql_2.11', version: '2.4.5'
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.2'
compile 'org.apache.commons:commons-math3:3.6.1'
compile group: 'org.apache.commons', name: 'commons-text', version: '1.8'
compile group: 'org.codehaus.janino', name: 'janino', version: '3.1.2'
// Gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
// Java tuple for Pair.
compile group: 'org.javatuples', name: 'javatuples', version: '1.2'
// Lombok dependency
compileOnly 'org.projectlombok:lombok:1.18.12'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
Getting issue of could not initialise. Please let me know what I am missing . I can see in dependency tree that new version of netty handler is getting used
20/09/13 18:57:43 ERROR Schedulers: Scheduler worker in group main failed with an uncaught exception
java.lang.NoSuchMethodError: io.netty.handler.ssl.SslProvider.isAlpnSupported(Lio/netty/handler/ssl/SslProvider;)Z
at reactor.netty.http.client.HttpClientSecure.<clinit>(HttpClientSecure.java:79)
at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.lambda$subscribe$0(HttpClientConnect.java:301)
at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57)
at reactor.core.publisher.FluxRetryPredicate$RetryPredicateSubscriber.resubscribe(FluxRetryPredicate.java:124)
at reactor.core.publisher.MonoRetryPredicate.subscribeOrReturn(MonoRetryPredicate.java:51)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.subscribe(HttpClientConnect.java:326)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:52)
at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:33)
at reactor.core.publisher.FluxDelaySubscription$DelaySubscriptionOtherSubscriber.onNext(FluxDelaySubscription.java:123)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:117)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

JAXB & java.mail Java 11: Module problems

When I converted an application, that uses jaxb & java.mail, from java 8 to java 11 I had lots of module problems that seemed intractable.
My build.gradle included:
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
compile group: 'javax.mail', name: 'mail', version: '1.4.7'
The module errors I got included:
the unnamed module reads package javax.activation from both java.activation and activation
I tried this but it didn't work with the same error:
compile (group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1') {
exclude group: 'javax.activation', module: 'activation'
}
compile group: 'javax.mail', name: 'mail', version: '1.4.7'
And I tried this which also failed:
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
compile (group: 'javax.mail', name: 'mail', version: '1.4.7') {
exclude group: 'javax.activation', module: 'activation'
}
The error was:
java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
Also tried using in gradle with various exclude statements that all failed one way or another:
compile (group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1')
compile (group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0.1')
compile (group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0.1')
Also got runtime error:
class not found com.sun.activation.registries.LogSupport
Solution
In the end I found that using glassfish.jaxb and jakarta.mail worked.
My build.gradle included:
compile(group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2') {
exclude group: 'jakarta.activation', module: 'jakarta.activation-api'
}
compile group: 'com.sun.mail', name: 'jakarta.mail', version: '1.6.5'
My module-info.java included:
requires java.xml.bind;
requires jakarta.mail;
requires com.sun.xml.bind; // needed this for jlink
Hope this helps.

Scala, IntelliJ and Gradle dependencies

I am trying to change my project dependencies to Scala 2.11 as I am having troubles with 2.12. My current plugin installation is 2.12. How can I change everything to 2.11?
My project is built on Gradle and this is my build.gradle class:
group 'ics5114'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.3.0'
compile group: 'org.apache.spark', name: 'spark-sql_2.11', version: '2.3.0'
compile group: 'org.apache.spark', name: 'spark-graphx_2.11', version: '2.3.0'
}
jar {
zip64 true
archiveName = "music-graph-spark.jar"
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'com.sparkTutorial.sparkSql.StackOverFlowSurvey'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}

ClassNotFoundException: com.liferay.portal.kernel.model.BaseModelListener

I wrote a Liferay module:
#Component(
immediate = true,
service = ModelListener.class
)
public class TopMessageListener extends BaseModelListener<JournalArticle> {
// Do stuff
}
with this bnd.bnd:
Bundle-SymbolicName: fr.free.nrw.impl
Bundle-Version: 1.0.0
Liferay-Require-SchemaVersion: 1.0.0
Import-Package: !org.apache.avalon.framework.logger, !org.apache.log \
*
And this in my build.gradle (among other things):
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileInclude group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
It compiles fine, but deployment fails:
ClassNotFoundException: com.liferay.portal.kernel.model.BaseModelListener cannot be found by fr.free.nrw.impl_1.0.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:444)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:357)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:349)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
The error disappears if I replace compileOnly group: "com.liferay.portal" with compileInclude group: "com.liferay.portal", but I am sure it is not the correct way to do things. How to correctly fix the ClassNotFoundException above?
Please try this dependency
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
Duplicate the httpcomponents line into two lines, one compileOnly and one runtime:
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
runtime group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
That solved the problem for me.

Resources