I am trying to prepare a basic pipeline on jenkins, and although the local build works ok for the same task, it fails on jenkins with
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.gradle.internal.concurrent.CompositeStoppable.<clinit>(CompositeStoppable.java:37)
at org.gradle.internal.classloader.ClassLoaderUtils.tryClose(ClassLoaderUtils.java:51)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:64)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
The build file has the below configs for dependencies:
configurations {
all*.exclude group: 'com.google.guava', module:'guava-jdk5'
all*.exclude group: 'ch.qos.logback', module: 'logback-core'
all*.exclude group: 'ch.qos.logback', module: 'logback-classic'
all*.exclude module: 'slf4j-log4j12'
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
compile group: 'org.slf4j', name:'slf4j-api', version: '1.7.29'
compile group: 'org.slf4j', name:'slf4j-log4j12', version:'1.5.6'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.10.0'
compile "com.google.guava:guava:23.0"
compile 'io.reactivex.rxjava2:rxjava:2.2.7'
compile group: 'org.springframework', name: 'spring-context', version: '5.0.4.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '5.0.4.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.0.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '2.0.0.RELEASE'
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.4'
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.1-groovy-2.4'
testCompile group: 'org.spockframework', name: 'spock-spring', version: '1.1-groovy-2.4'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.0.RELEASE'
testCompile "cglib:cglib:2.2"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
jenkins file
pipeline {
agent any
stages {
stage("Build") {
steps {
bat 'project/gradlew.bat -Djava.home=C:\\Program Files\\Java\\jdk1.8.0_172 -b project/build.gradle test'
}
}
}
}
I have tried to update the versions of the libs and enabled/disabled the exclusion parts, but the error still happens on jenkins, while on my local nothing unusual. can anyone point out what might be the reason and solution to that?
Related
I received the following error
java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
at org.junit.platform.launcher.core.LauncherFactory.loadAndFilterTestExecutionListeners(LauncherFactory.java:122)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:108)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:75)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.(JUnit5TestLoader.java:34)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:371)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:366)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:310)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:225)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.ClassNamePatternFilterUtils
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 16 more
and this my gradle file
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-validation'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.springframework.boot:spring-boot-starter-json'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
runtime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testCompile('org.apache.commons:commons-compress:1.19')
testImplementation 'io.projectreactor:reactor-test'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
compile group: 'commons-codec', name: 'commons-codec', version: '1.14'
compile group: 'org.json', name: 'json', version: '20180813'
compile group: 'com.opencsv', name: 'opencsv', version: '5.1'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.852'
compile("io.springfox:springfox-swagger2:2.9.2"){
exclude group:"com.google.guava", module:"guava"
}
compile("io.springfox:springfox-swagger-ui:2.9.2"){
exclude group:"com.google.guava", module:"guava"
}
runtime group: 'org.springframework.cloud', name: 'spring-cloud-dependencies', version: 'Hoxton.SR6', ext: 'pom'
compile group: 'io.spring.gradle', name: 'dependency-management-plugin', version: '1.0.9.RELEASE'
implementation ('org.reflections:reflections:0.9.10') {
exclude group: 'com.google.code.findbugs', module: 'annotations'
}
implementation 'commons-io:commons-io:2.5'
implementation("org.springframework.cloud:spring-cloud-starter-openfeign:2.2.0.RELEASE"){
exclude group:"ch.qos.logback", module:"logback-classic"
}
implementation 'io.github.openfeign:feign-jackson:11.0'
implementation 'io.github.openfeign:feign-httpclient:11.0'
compile group: 'io.github.openfeign.form', name: 'feign-form-spring', version: '3.5.0'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.0'
implementation 'org.alfresco:alfresco-data-model:6.19#jar'
implementation 'xerces:xercesImpl:2.9.1#jar'
}
test {
useJUnitPlatform()
}
I found missing the following lines in build.gradle file
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.7.1'
after adding this it works completely fine.
I m currently trying to write a Publisher for Kafka Messages using Spark and Java. The requirement is I will have a Dataset with few records. I need to only publish these records on Kafka queue on a topic.
Following is the publisher code written in Java:
Dataset dataset = messageDataSet.select("value");
dataset.selectExpr("CAST(value AS STRING)")
.write()
.format("kafka")
.option("topic","batch")
.option("kafka.bootstrap.servers","kafka01.qa.com:9092")
.save();
I have added following things is gradle , since the deployment guide of Streaming Kafka Integration says to have the gradle dependecies as provided I have also tried that.
dependencies {
compile group: 'com.util', name:'core-utilities-jdk8',version: '0.0.2-spark'
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.8'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.687'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
compile group: 'org.apache.spark', name: 'spark-core_2.12', version: "$sparkVersion"
compile group: 'org.apache.spark', name: 'spark-sql_2.12', version: "$sparkVersion"
compile group: 'com.databricks', name: 'spark-csv_2.11', version: '1.5.0'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'org.apache.spark', name: 'spark-streaming-kafka-0-10_2.11', version: "$sparkVersion"
compile group: 'org.apache.spark', name: 'spark-streaming_2.12', version: "$sparkVersion"
compile group: 'org.apache.spark', name: 'spark-sql-kafka-0-10_2.12', version: "$sparkVersion"
annotationProcessor 'org.projectlombok:lombok:1.18.10'
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-scala_2.12', version: '2.10.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.10.1'
compile group: 'com.jcraft', name: 'jsch', version: '0.1.55'
}
The dependecy I have tried as ProvidedCompile for Kafka and Spark Core but the error continues to be following :
User class threw exception: java.util.ServiceConfigurationError:
org.apache.spark.sql.sources.DataSourceRegister: Provider
org.apache.spark.sql.kafka010.KafkaSourceProvider could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at scala.collection.convert.Wrappers$JIteratorWrapper.next(Wrappers.scala:43)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.filterImpl(TraversableLike.scala:247)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:259)
at scala.collection.AbstractTraversable.filter(Traversable.scala:104)
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:630)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:245)
at com.fileprocessor.jobs.Runner.publishMessage(Runner.java:200)
at com.fileprocessor.SparkFileProcessorMain.main(SparkFileProcessorMain.java:12)
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:498)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:684)
Caused by: java.lang.NoSuchMethodError:
org.apache.spark.internal.Logging.$init$(Lorg/apache/spark/internal/Logging;)V
at org.apache.spark.sql.kafka010.KafkaSourceProvider.<init>(KafkaSourceProvider.scala:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
I want to simply publish by dataset to Kafka Queues . Spark version is 2.4.4
I have went through the different results of Having transformenrs in Gradle , or downgrading the things for Kafka versions and scala . But nothing has helped . Anyone if have faced similar situation ?
Tried : spark-submit --packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.4 --class com.fileprocessor.SparkFileProcessorMain --master local[*] file-processor-spark-jobs-1.0-SNAPSHOT.jar
Or If any one have anyother way to write the similar code ?
Following gradle worked:
dependencies {
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.8'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.687'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
compile group: 'org.apache.spark', name: 'spark-core_2.12', version: "$sparkVersion"
compile group: 'org.apache.spark', name: 'spark-sql_2.12', version: "$sparkVersion"
compile group: 'com.databricks', name: 'spark-csv_2.11', version: '1.5.0'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'org.apache.spark', name: 'spark-streaming-kafka-0-10_2.11', version: "$sparkVersion"
providedCompile group: 'org.apache.spark', name: 'spark-streaming_2.12', version: "$sparkVersion"
providedCompile group: 'org.apache.spark', name: 'spark-sql-kafka-0-10_2.11', version: "2.2.0"
annotationProcessor 'org.projectlombok:lombok:1.18.10'
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-scala_2.12', version: '2.10.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.10.1'
compile group: 'com.jcraft', name: 'jsch', version: '0.1.55'
}
And spark submit : spark-submit --packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.3.0 --class com.fileprocessor.SparkFileProcessorMain --master local[*] file-processor-spark-jobs-1.0-SNAPSHOT.jar test bottomline false
I have migrated my project from java-8 to java-9 but post the migration i am getting xml parsing error in some job which is running.
The project is a gradle project and i have added the necessary changes in build.gradle to add jaxb dependencies.
Below is my build.gradle dependency:
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.3'
compile "org.openjfx:javafx-base:11:win"
compile "org.openjfx:javafx-graphics:11:win"
compile "org.openjfx:javafx-controls:11:win"
compile "org.openjfx:javafx-fxml:11:win"
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0'
compile 'javax.annotation:javax.annotation-api:1.3.1'
compile 'com.sun.activation:javax.activation:1.2.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-ri', version: '2.3.0', ext: 'pom'
compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.3.0'
testCompile group: 'junit', name: 'junit', version: "${junitVersion}"
testCompile group: 'org.springframework', name: 'spring-test', version: "${springVersion}"
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.5'
}
Below is the error that I'm facing(Occurs randomly but too often):
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,379459]
Message: Character reference "" is an invalid XML character.
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.peek(Unknown Source)
at microsoft.exchange.webservices.data.core.EwsXmlReader.isEmptyElement(EwsXmlReader.java:1037)
at microsoft.exchange.webservices.data.core.EwsXmlReader.readElementValue(EwsXmlReader.java:358)
at microsoft.exchange.webservices.data.property.definition.TypedPropertyDefinition.loadPropertyValueFromXml(TypedPropertyDefinition.java:133)
at microsoft.exchange.webservices.data.property.definition.StringPropertyDefinition.loadPropertyValueFromXml(StringPropertyDefinition.java:34)
at microsoft.exchange.webservices.data.core.PropertyBag.loadFromXml(PropertyBag.java:510)
at microsoft.exchange.webservices.data.core.service.ServiceObject.loadFromXml(ServiceObject.java:298)
at microsoft.exchange.webservices.data.core.response.SyncResponse.readElementsFromXml(SyncResponse.java:158)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.loadFromXml(ServiceResponse.java:133)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:76)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:44)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:433)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:401)
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:63)
... 23 common frames omitted
Replace all occurrences of with the correct XML numeric character reference
(or, of course
, the decimal equivalent).
Then the error should vanish.
I am trying to build Gradle using ./gradlew build but during compilation getting following error package not found.In eclipse I am able to run refresh gradle but in command prompt facing the below issue :
> Task :compileJava FAILED
/Users/Documents/em-cedm-integ-test/src/main/java/com/BaseTest.java:3: error: package io.restassured does not exist
import static io.restassured.RestAssured.given;
^
/Users/Documents/em-cedm-integ-test/src/main/java/com/BaseTest.java:3: error: static import only from classes and interfaces
import static io.restassured.RestAssured.given;
^
/Users/Documents/em-cedm-integ-test/src/main/java/com/BaseTest.java:21: error: package org.apache.commons.lang3 does not exist
import org.apache.commons.lang3.StringUtils;
^
/Users/Documents/em-cedm-integ-test/src/main/java/com/BaseTest.java:34: error: package io.restassured.response does not exist
import io.restassured.response.ExtractableResponse;
^
/Users/Documents/em-cedm-integ-test/src/main/java/com/BaseTest.java:35: error: package io.restassured.response does not exist
import io.restassured.response.Response;
^
/Users/Documents/em-cedm-integ-test/src/main/java/com/CedmTest.java:3: error: package org.junit.runner does not exist
import org.junit.runner.JUnitCore;
^
^
Build.gradle file I am using
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java'
allprojects {
repositories {
// You can declare any Maven/Ivy/file repository here.
maven {
url "http://repo.hortonworks.com/content/repositories/releases"
}
maven {
url "${artifactory_contextUrl}"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven {
url "${artifactory_contextUrl}/ip-fci-maven-virtual"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
configurations.all {
transitive = false
}
}
version = '1.0'
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'com.ibm.cedm.CedmTest'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
defaultTasks 'downloadFile'
dependencies {
compile group: 'com.google.guava', name: 'guava', version: '12.0.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'
compile group: 'org.apache.kafka', name: 'kafka-clients', version: '0.11.0.3'
compile group: 'org.apache.hbase', name: 'hbase-client', version: '1.1.2.2.6.4.0-91'
compile group: 'org.apache.hbase', name: 'hbase-common', version: '1.1.2.2.6.4.0-91'
compile group: 'org.apache.hbase', name: 'hbase-client', version: '1.1.2.2.6.4.0-91'
compile group: 'org.apache.hadoop', name: 'hadoop-common', version: '2.7.3.2.6.4.0-91'
compile group: 'com.tdunning', name: 'json', version: '1.8'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.10'
compile group: 'org.apache.oozie', name: 'oozie-client', version: '4.2.0'
compileOnly group: 'io.swagger', name: 'swagger-annotations', version: '1.5.12'
compileOnly group: 'javax', name: 'javaee-api', version: '7.0'
compile group: 'ip-fci-generic-local.fcco-core', name: 'fci-core-utils', version: 'master'
compile(group: 'ip-fci-generic-local.media', name: 'db2jcc4', version: '11.1.3')
testImplementation 'junit:junit:4.12'
testCompile group: 'commons-codec', name: 'commons-codec', version: '1.9'
testCompile group: 'com.tdunning', name: 'json', version: '1.8'
testCompile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
testCompile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.6'
testCompile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.10'
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
testCompile group: 'commons-logging', name: 'commons-logging', version: '1.2'
testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.0.2'
testCompile group: 'io.rest-assured', name: 'rest-assured-common', version: '3.0.2'
testCompile group: 'io.rest-assured', name: 'json-path', version: '3.0.2'
testCompile group: 'io.rest-assured', name: 'xml-path', version: '3.0.2'
testCompile group: 'net.javacrumbs.json-unit', name: 'json-unit', version: '1.5.2'
testCompile group: 'net.javacrumbs.json-unit', name: 'json-unit-core', version: '1.5.2'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'org.codehaus.groovy', name: 'groovy', version: '2.4.4'
testCompile group: 'org.codehaus.groovy', name: 'groovy-json', version: '2.4.4'
testCompile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
testCompile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.25'
}
/*
test {
filter {
//include specific method in any of the tests
includeTestsMatching "*createBasicIndividualParty"
}
}
*/
Can someone please tell me why it is so? and what changes I should I make it to work?
How dependency mapped
dependencies mapped with testCompile will be compiled with src/test/java classes
dependencies mapped with compile will be compiled with src/main/java classes
Issue with the gradle config
Few dependencies are mapped as testCompile but it could be referenced in production code src/main/java.
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
Should be
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
I try to run project with gretty. It throws exception:
10:47:39 WARN Failed startup of context o.a.g.JettyWebAppContext#52045dbe{/,file:/C:/IdeaProjects/example-tab/build/inplaceWebapp/,STARTING}
java.lang.RuntimeException: Error scanning entry module-info.class from jar file:/C:/Users/user1/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.10.0/fec5797a55b786184a537abd39c3fa1449d752d6/log4j-api-2.10.0.jar
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:164) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:549) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) ~[jetty-util-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) ~[jetty-util-9.2.24.v20180105.jar:9.2.24.v20180105]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_171]
Caused by: java.lang.UnsupportedOperationException: null
at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:129) ~[asm-6.1.1.jar:na]
at org.objectweb.asm.ClassReader.readModule(ClassReader.java:667) ~[asm-6.1.1.jar:na]
at org.objectweb.asm.ClassReader.accept(ClassReader.java:503) ~[asm-6.1.1.jar:na]
at org.objectweb.asm.ClassReader.accept(ClassReader.java:355) ~[asm-6.1.1.jar:na]
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) ~[jetty-annotations-9.2.24.v20180105.jar:9.2.24.v20180105]
... 6 common frames omitted
gradle:
plugins {
id 'java'
id 'war'
id "org.gretty" version "2.2.0"
}
group 'ru.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
ext {
SPRING_VERSION = '5.1.0.RELEASE'
JUNIT_VERSION = '5.3.1'
JACKSON_VERSION = '2.9.7'
}
repositories {
mavenCentral()
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/releases/'
}
}
gretty {
springBootVersion = '2.0.5.RELEASE'
contextPath = "/"
}
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compileOnly group: 'com.google.appengine', name: 'appengine-endpoints-deps', version: '1.9.65'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'org.springframework', name: 'spring-webmvc', version: SPRING_VERSION
compile group: 'org.springframework', name: 'spring-web', version: SPRING_VERSION
compile group: 'org.springframework', name: 'spring-jdbc', version: SPRING_VERSION
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.0.5.RELEASE'
compile group: 'com.mchange', name: 'c3p0', version: '0.9.5.2'
compile group: 'com.zaxxer', name: 'HikariCP', version: '3.2.0'
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.3.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: JACKSON_VERSION
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: JACKSON_VERSION
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: JUNIT_VERSION
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: JUNIT_VERSION
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.3.1'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.22.0'
testCompile group: 'org.springframework', name: 'spring-test', version: SPRING_VERSION
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'com.jayway.jsonpath', name: 'json-path-assert', version: '2.4.0'
}
test {
useJUnitPlatform()
}
Scanning internet not helped. Please advice how to run it correctly. I had problems with downloading dependencies from jcenter(), may be, problem is here.
Validator write that my question have mostly code, but I have no Idea what to add to my explain, than, my apologies, I'll quote Steve Jobs:
“You can’t connect the dots looking forward; you can only connect them looking backward. So you have to trust that the dots will somehow connect in your future.”
You introduced a JEP-238 Jar file into your project: log4j-api-2.10.0.jar
Support for JEP-238 Jar files on any Java Runtime (doesn't matter if it's Java 7, Java 8, Java 9, Java 10, Java 11, or even the new Java 12-ea releases) was first introduced in Jetty 9.4.9.
You have 2 options:
Don't use JEP-238 Jar Files in your project.
Upgrade to Jetty 9.4.9 (or newer) to have support for JEP-238 Jar Files.
See past answers:
https://stackoverflow.com/a/45362629/775715
https://stackoverflow.com/a/52722120/775715