Bug 569387 - Simple JUnit5 test fails with java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
Summary: Simple JUnit5 test fails with java.lang.NoClassDefFoundError: org/junit/platf...
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2020-12-02 05:59 EST by Lars Vogel CLA
Modified: 2020-12-28 03:52 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2020-12-02 05:59:21 EST
If I run the JUnit test from the below code I get the error below , while a JUnit test works fine.

----
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class FooTest {

	@Test
	public void junit5Test() {
		Assertions.assertTrue(true);
	}

}
------

Manifest looks like the following:
------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests
Bundle-SymbolicName: model.tests
Bundle-Version: 1.2.0.qualifier
Automatic-Module-Name: aero.minova.rcp.model.tests
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: org.junit;version="4.12.0",
 org.junit.jupiter.api;version="5.0.0"
Require-Bundle: org.junit.jupiter.engine;bundle-version="5.6.0"
------


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.<init>(JUnit5TestLoader.java:34)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.lang.Class.newInstance(Class.java:584)
	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:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 14 more
Comment 1 Andrey Loskutov CLA 2020-12-03 12:04:49 EST
(In reply to Lars Vogel from comment #0)
> If I run the JUnit test from the below code I get the error below , while a
> JUnit test works fine.

What is the difference between "JUnit test" and "JUnit test"?
Please attach full projects to reproduce.
Comment 2 Lars Vogel CLA 2020-12-17 06:16:39 EST
Failed to reproduce in a small example.
Comment 3 Luke Usherwood CLA 2020-12-28 03:52:59 EST
See Bug 569860. (Maybe this resolved itself after you bumped the JUnit 5 version?)