Reputation: 67
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()
}
Upvotes: 4
Views: 3020
Reputation: 67
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.
Upvotes: 0