NoClassDefError with JUnit Jupiter 5.7.0
See original GitHub issueHi, I want to use 0.9.1 JUnit Pioneer’s @org.junitpioneer.jupiter.SetSystemProperty
but it currently fails with JUnit Jupiter 5.7.0:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven-deluxe/3.6.3-0/libexec
Java version: 11.0.8, vendor: N/A, runtime: /usr/local/Cellar/openjdk@11/11.0.8/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
[...]
WARNING: TestEngine with ID 'junit-jupiter' failed to execute tests
java.lang.NoClassDefFoundError: org/junit/platform/commons/util/UnrecoverableExceptions
at org.junit.jupiter.engine.support.OpenTest4JAndJUnit4AwareThrowableCollector.createAbortedExecutionPredicate(OpenTest4JAndJUnit4AwareThrowableCollector.java:58)
at org.junit.jupiter.engine.support.OpenTest4JAndJUnit4AwareThrowableCollector.<clinit>(OpenTest4JAndJUnit4AwareThrowableCollector.java:41)
at org.junit.jupiter.engine.support.JupiterThrowableCollectorFactory.createThrowableCollector(JupiterThrowableCollectorFactory.java:34)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:78)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.UnrecoverableExceptions
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 18 more
It does not fail with JUnit Jupiter 5.6.2.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:23 (22 by maintainers)
Top Results From Across the Web
java.lang.NoClassDefFoundError: org/junit/platform/commons ...
I have my doubts about that....Remove platform-launcher only junit-jupiter-engine is usually needed for running JUnit 5 tests ...If you have ...
Read more >"java.lang.NoClassDefFoundError: org/junit/platform/commons ...
I recently upgraded JUnit version from 5.5.2 to 5.7.0. ... WARNING: TestEngine with ID 'junit-jupiter' failed to execute tests java.lang.
Read more >Fixing the NoSuchMethodError JUnit Error - Baeldung
In this article, we're going to learn how to fix the NoSuchMethodError and NoClassDefFoundError JUnit errors. Such problems usually occur ...
Read more >Issue Open Jdk 11: java.lang.NoClassDefFoundError: org/junit ...
NoClassDefFoundError : org/junit/rules/TestRule I build the plugin on ... [INFO] +- org.junit.jupiter:junit-jupiter:jar:5.7.0:test [INFO] ...
Read more >org.junit.jupiter.api.extension.ScriptEvaluationException ...
Hi, I have encountered the following issue when I am running the "mvn test -Dtest=ConnectionTest" :"java.lang.ClassNotFoundException: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fbiville I think you can fix this by adding
junit-bom
to your project. While it’s briefly mentioned in https://junit.org/junit5/docs/current/user-guide/#dependency-metadata-junit-bom in neither the case of Maven or Gradle does it tell you how to actually do it. Add to yourpom.xml
and let us know if it fixes the issue for you:I have created #346. While, not a necessary change, it is probably safer to do so that the versions of jupiter and platform are automatically aligned for all possible dependencies.