Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 450799 - Can't run Java EE application on server due to NoClassDefFoundError
Summary: Can't run Java EE application on server due to NoClassDefFoundError
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major with 1 vote (vote)
Target Milestone: 3.6.3   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-09 19:46 EST by Serge B CLA
Modified: 2015-02-04 10:28 EST (History)
9 users (show)

See Also:
shr31223: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
shr31223: pmc_approved? (naci.dai)
shr31223: pmc_approved? (neil.hauge)
shr31223: pmc_approved? (cbridgha)
shr31223: pmc_approved? (kaloyan)
shr31223: pmc_approved? (ccc)
cbridgha: review+


Attachments
References of plugin org.eclipse.wst.common.modulecore (44.70 KB, image/png)
2014-12-04 15:02 EST, Serge B CLA
no flags Details
Proposed patch (847 bytes, patch)
2015-01-30 13:17 EST, Roberto Sanchez Herrera CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Serge B CLA 2014-11-09 19:46:01 EST
When I try to run a Java EE application on any Java EE application server, nothing happens and NoClassDefFoundError appears in the eclipse error log. I can publish application neither to WebSphere 8.5 nor to Tomcat 7.0.

What steps will reproduce the problem?
1. Create Dynamic Web Project.
2. Add new server
3. Open Servers view
4. Right-click on the new server
5. Choose Add and Remove... menu item

Expected result:
Add or Remove applications Dialog appears.

Actual result:
Nothing happens.
ClassNotFoundException in error log.


-- Error Details --
Date: Mon Nov 10 04:14:39 GMT+04:00 2014
Message: Unhandled event loop exception
Severity: Error
Product: Eclipse 2.0.2.20140224-0000 (org.eclipse.epp.package.standard.product)
Plugin: org.eclipse.ui
Session Data:
eclipse.buildId=4.3.2.M20140221-1700
java.version=1.7.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_RU
Framework arguments:  -product org.eclipse.epp.package.standard.product -product org.eclipse.epp.package.standard.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product -data C:\home\sergey\workspaces\default -product org.eclipse.epp.package.standard.product

Exception Stack Trace:
java.lang.NoClassDefFoundError: org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipant
	at org.eclipse.jst.j2ee.internal.deployables.JEEFlattenParticipantProvider.findParticipant(JEEFlattenParticipantProvider.java:62)
	at org.eclipse.wst.common.componentcore.internal.flat.FlattenParticipantModel$FlattenParticipantProviderWrapper.findParticipant(FlattenParticipantModel.java:115)
	at org.eclipse.wst.common.componentcore.internal.flat.FlattenParticipantModel.getParticipant(FlattenParticipantModel.java:50)
	at org.eclipse.wst.common.componentcore.internal.flat.FlattenParticipantModel.getParticipant(FlattenParticipantModel.java:43)
	at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.getFlattenParticipants(FlatComponentDeployable.java:156)
	at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.getParticipants(FlatComponentDeployable.java:138)
	at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.getFlatComponent(FlatComponentDeployable.java:118)
	at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.getExportModelChildren(FlatComponentDeployable.java:251)
	at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.getModules(FlatComponentDeployable.java:263)
	at com.ibm.ws.ast.st.common.core.internal.AbstractWASServer.canModifyModules(AbstractWASServer.java:226)
	at org.eclipse.wst.server.core.internal.Server.canModifyModules(Server.java:2491)
	at org.eclipse.wst.server.ui.internal.view.servers.ModuleSloshAction.perform(ModuleSloshAction.java:84)
	at org.eclipse.wst.server.ui.internal.view.servers.AbstractServerAction.run(AbstractServerAction.java:64)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Caused by: java.lang.ClassNotFoundException: org.eclipse.wst.common.componentcore.internal.flat.GlobalHeirarchyParticipant cannot be found by org.eclipse.jst.j2ee_1.1.710.v201401281800
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 42 more
Comment 1 Roberto Sanchez Herrera CLA 2014-11-19 10:37:23 EST
Hello Serge, 

Looks like you are using the Kepler SR2 Standard package (Product: Eclipse 2.0.2.20140224-0000 (org.eclipse.epp.package.standard.product), eclipse.buildId=4.3.2.M20140221-1700. 

I wonder, how did you install the Java EE tools in your eclipse? If you selected Help > Install new software, make sure you installed Eclipse Web Developer tools, Eclipse Java Web developer tools and Eclipse Java EE Developer tools

Could you provide the steps you followed to install on your Standard eclipse package?

Thanks.
Comment 2 Serge B CLA 2014-11-19 10:53:34 EST
I'm not sure I can recollect all the steps exactly.

First I installed latest Eclipse release.

Then I added necessary features when it was necessary.

I opened eclipse marketplace, searched plugins by keyword 'WebSphere'.

I had been using WebSphere 6.1 and 7.0.

Recently I installed plugins for WebSphere 8.5 and removed old plugins for WebSphere 6.1 and 7.0.
Comment 3 Roberto Sanchez Herrera CLA 2014-11-19 11:14:52 EST
So, looks like the steps could be:

1. Use Eclipse Kepler SR2 standard package
2. Install from market place the WebSphere 6.1 and 7 server adapters
3. Install from market place the WebSphere 8.5 server adapters
4. Remove the WebSphere 6.1 and 7 server adapters

Is this correct? 
How did you uninstall/remove the old plugins for WebSphere 6.1 and 7.0?


Will try to recreate the problem, but probably the fastest way to get your setup working again is to start with a fresh install.
Comment 4 Serge B CLA 2014-11-19 11:47:33 EST
Yes, I beleive it might be like that.

To uninstall plugins I perform the following steps:

1. Help
2. Install New Software
3. What is already installed
4. Select plugin to remove
5. Press button Uninstall...



Do you mean I have to uninstall my Ecplise and reinstall it from scratch?
Comment 5 Roberto Sanchez Herrera CLA 2014-11-20 17:46:49 EST
Hi, 
I tried to reproduce this problem installing and removing the WebSphere 7, 8 and 8.5 server adapters from Market place (there is no WebSphere 6.1 server adapter in market place, at least I could not find any), without any luck. 

I noticed by looking at the stack trace, that JEEFlattenParticipantProvider.findParticipant (located in plugin org.eclipse.jst.j2ee) is calling GlobalHeirarchyParticipant (located in org.eclipse.wst.common.modulecore) and cannot find it. 

I checked the code, and when the call to GlobalHeirarchyParticipant was added in JEEFlattenParticipantProvider.findParticipant, the minimum version for org.eclipse.wst.common.modulecore in org.eclipse.jst.j2ee's manifest was not updated to the first version in which the class GlobalHeirarchyParticipant is in the plugin. 

So, this makes me think that somehow the plugin org.eclipse.wst.common.modulecore is backleveled (as result of installing/removing plugins), and is being used a version that does not have GlobalHeirarchyParticipant.

Could you tell me which version of plugin org.eclipse.wst.common.modulecore you have in your installation?

And to try to fix your current installation, I can suggest a couple of things to try to bring your plugins back to a usable state:

1. Select Help > Install New software, select the Kepler update site (Kepler - http://download.eclipse.org/releases/kepler), expand Web, XML, Java EE and OSGi, and check if you can refresh Eclipse Java EE Developer tools, Eclipse Java Web Developer Tools, and Eclipse Web Developer tools, or all that you see installed. 

2.  Download the WTP update site for Kepler SR2 from here: http://www.eclipse.org/downloads/download.php?file=/webtools/downloads/drops/R3.5.2/R-3.5.2-20140217150812/wtp4x-repo-R-3.5.2-20140217150812.zip and install the complete WTP again.
Comment 6 Roberto Sanchez Herrera CLA 2014-11-20 17:51:54 EST
For option 2, instead of downloading the update site, you can try using this repository: http://download.eclipse.org/webtools/repository/kepler
Comment 7 Serge B CLA 2014-11-20 18:14:19 EST
Thank you.

I examined the plugins directory of my Eclipse and noticed 2 files:

org.eclipse.wst.common.modulecore_1.2.202.v201305061700.jar
org.eclipse.wst.common.modulecore_1.2.302.v201311131500.jar

The second one contains class GlobalHeirarchyParticipant, which Eclipse reports as missing.

May be this can help to locate the reason of the fault.

I recollected that the problem first happened after I installed Android Development Tools.
Comment 8 Roberto Sanchez Herrera CLA 2014-11-21 16:51:25 EST
I Installed ADT and still have the correct version of org.eclipse.wst.common.modulecore (org.eclipse.wst.common.modulecore_1.2.302.v201311131500.jar).

Can you check which version of the plugin org.eclipse.wst.common.modulecore is shown in the dialog Help > About Eclipse > Installation Details > Plugins?

Did you try starting eclipse with the -clean option?  

Another option could be to check who is requiring the old version of the plugin. If you open the plugins view, select the plugin org.eclipse.wst.common.modulecore, do a right click and select Find references, you can see which plugins are referencing the old plugin
Comment 9 Serge B CLA 2014-12-03 16:04:55 EST
My Eclipse shows version 1.2.202.v201305061700 of plugin org.eclipse.wst.common.modulecore.
Comment 10 Serge B CLA 2014-12-04 15:02:03 EST
Created attachment 249178 [details]
References of plugin org.eclipse.wst.common.modulecore

References view of plugin org.eclipse.wst.common.modulecore is in file module-core-refs.png.
Comment 11 Serge B CLA 2014-12-04 15:38:12 EST
I found a workaround.

After I copied the file org.eclipse.wst.common.modulecore_1.2.302.v201311131500.jar to org.eclipse.wst.common.modulecore_1.2.202.v201305061700.jar, the problem disappeared.

Now everything works.
Comment 12 Roberto Sanchez Herrera CLA 2014-12-19 13:10:12 EST
I will use this bug to update the minimum version for org.eclipse.wst.common.modulecore in org.eclipse.jst.j2ee's manifest
Comment 13 Roberto Sanchez Herrera CLA 2015-01-30 13:17:11 EST
Created attachment 250393 [details]
Proposed patch

The patch updates the required version of org.eclipse.wst.common.modulecore. This change should be done in both Master and R3_6_maintenance
Comment 14 Roberto Sanchez Herrera CLA 2015-01-30 17:47:58 EST
Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.
Not a stop ship, but not fixing this can cause java.lang.NoClassDefFoundError in scenarios like the one reported in this bug which is bad. 

Is there a work-around? If so, why do you believe the work-around is insufficient?
No. 

How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?
Tested manually that there are no compilation errors after changing the min required version. I verified manually that the class GlobalHeirarchyParticipant is the plugin with that min version.

Give a brief technical overview. Who has reviewed this fix?
The MANIFEST.MF file of org.eclipse.jst.j2ee had this:
org.eclipse.wst.common.modulecore;bundle-version="[1.2.101,2.0.0)";visibility:=reexport,
A class in org.eclipse.jst.j2ee uses another class in org.eclipse.wst.common.modulecore, but that class was added in a later version of org.eclipse.wst.common.modulecore. The fix is to change the min version of org.eclipse.wst.common.modulecore in MANIFEST.MF file of org.eclipse.jst.j2ee to a version that contains the used class. 
Chuck Bridgham reviewed the fix

What is the risk associated with this fix?
Low