This site is maintained for archival purposes only. Eclipse projects have transitioned to GitHub and Eclipse GitLab. Use the Projects search tool to locate your project and access its latest code and issue tracker.
Bug 525844 - [9] ClassNotFoundException trying to run JUnit-Tests under Java9
Summary: [9] ClassNotFoundException trying to run JUnit-Tests under Java9
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.7.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.7.2   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-11 03:13 EDT by Claus Klammer CLA
Modified: 2017-11-26 22:15 EST (History)
6 users (show)

See Also:
noopur_gupta: review+


Attachments
issue revealing projects (544.81 KB, application/octet-stream)
2017-10-11 03:13 EDT, Claus Klammer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Claus Klammer CLA 2017-10-11 03:13:21 EDT
Created attachment 270925 [details]
issue revealing projects

Version: Oxygen.1a (4.7.1a)
Build id: M20171009-0410

There seems to be another issue with JUnit-Test execution as fixed in #522395.

If JUnit libraries are provided by other project via project dependency JUnit-Test execution fails with stack trace see below.

How to reproduce: 
1) import provided projects (see attachment)
2) right click on class 'MyClassTest' and select 'Run as...' -> 'JUnit-Test' from the context menu

java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:292)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadTestLoaderClass(RemoteTestRunner.java:378)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:368)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:363)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:307)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:222)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.lang.ClassNotFoundException: org.junit.runner.manipulation.Filter
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	... 8 more
Comment 1 Sarika Sinha CLA 2017-10-11 04:14:58 EDT
org.eclipse.jdt.core.IJavaProject.getResolvedClasspath(boolean)

does not return the junit jars so it is not added in the classpath.
Comment 2 Claus Klammer CLA 2017-10-12 05:43:09 EDT
As interim workaround (till 4.7.2 is release in December)  the required libraries can be added to the classpath (UserEntries) of the JUnit launch configuration manually.
Comment 3 Eclipse Genie CLA 2017-11-07 05:55:51 EST
New Gerrit change created: https://git.eclipse.org/r/111110
Comment 4 Sarika Sinha CLA 2017-11-07 05:56:49 EST
As we have workaround, making normal.
Targeting for 4.8 M4 and 4.7.3
Comment 5 Claus Klammer CLA 2017-11-07 07:16:42 EST
(In reply to Sarika Sinha from comment #4)
> As we have workaround, making normal.
> Targeting for 4.8 M4 and 4.7.3

Yes, there is a workaround, but it is really a pain to add required dependencies to every test launch configuration manually. In addition there seems to be a fix. Why doesn't it make it to the version 4.7.2?
Comment 6 Sarika Sinha CLA 2017-11-08 00:56:27 EST
We don't have the fix in I build yet, and without much testing, to put it in 4.7.2  might cause problems.
Comment 7 Claus Klammer CLA 2017-11-08 01:54:35 EST
Thanks for targeting to 4.7.2 again. 
Even though I don't know the manual testing steps required to be accomplished I can offer to help testing here. Do you have automatic UI-Tests (SWT-Bot) - propably this would be the most easy path to follow for automation of these kinds of tests.
Comment 9 Sarika Sinha CLA 2017-11-08 02:12:51 EST
I have merged the changes to master, you can test in the next I build.
Comment 10 Claus Klammer CLA 2017-11-13 02:08:46 EST
FYI, the problem is still present on recent oxygen maintenance build:
 
Version: Oxygen.2 (4.7.2)
Build id: M20171108-1700
Comment 11 Sarika Sinha CLA 2017-11-13 03:53:38 EST
(In reply to Claus Klammer from comment #10)
> FYI, the problem is still present on recent oxygen maintenance build:
>  
> Version: Oxygen.2 (4.7.2)
> Build id: M20171108-1700

It has not been fixed in Oxygen builds, it has been fixed in I builds - Photon.
Comment 12 Claus Klammer CLA 2017-11-13 06:20:12 EST
(In reply to Sarika Sinha from comment #11)
> (In reply to Claus Klammer from comment #10)
> > FYI, the problem is still present on recent oxygen maintenance build:
> >  
> > Version: Oxygen.2 (4.7.2)
> > Build id: M20171108-1700
> 
> It has not been fixed in Oxygen builds, it has been fixed in I builds -
> Photon.

Thanks for the hint: I can confirm that the issue is resolved in Photon build:

Version: 4.8.0.v20171111-1500
Build id: I20171111-1500

Looking forward to oxygen backport or merge ;-)
Comment 13 Eclipse Genie CLA 2017-11-14 05:18:12 EST
New Gerrit change created: https://git.eclipse.org/r/111517
Comment 14 Eclipse Genie CLA 2017-11-14 05:19:25 EST
New Gerrit change created: https://git.eclipse.org/r/111518
Comment 15 Eclipse Genie CLA 2017-11-14 06:02:33 EST
Gerrit change https://git.eclipse.org/r/111517 was merged to [R4_7_maintenance].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=7e3f25027f9edae0db3300455d5f68b5ac64c836
Comment 16 Eclipse Genie CLA 2017-11-14 06:04:15 EST
Gerrit change https://git.eclipse.org/r/111518 was merged to [R4_7_maintenance].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=dea7670ec43f75f7acf5e1bccd3650ff1ef81b89
Comment 17 Sarika Sinha CLA 2017-11-14 06:07:19 EST
Released to 4.7.2 .
Comment 18 Sarika Sinha CLA 2017-11-15 01:50:06 EST
Verified in Eclipse SDK

Version: Oxygen.2 (4.7.2)
Build id: M20171114-1700
Comment 19 Wolfgang Zitzelsberger CLA 2017-11-25 10:20:58 EST
Looks like the issue still remains in module mode - using 4.7.2 RC3
Comment 20 Sarika Sinha CLA 2017-11-26 22:15:32 EST
(In reply to Wolfgang Zitzelsberger from comment #19)
> Looks like the issue still remains in module mode - using 4.7.2 RC3

Junit tests  are not working in modular project right now , see Bug 525948.