Eclipse Juno with web tool platform - HTTP view in localhost throws NoClassDefFoundError

I keep getting NoClassDefFoundError: org/eclipse/jetty/webapp/WebAppContext when I try to start an HTTP view in Eclipse Juno using the web tool platform.

Steps to play:

  • Download, Extract, and Run Eclipse Juno
  • Install “Eclipse Web Developer Tools” through “Install New Software ...” from http://download.eclipse.org/releases/juno
  • Create a new "Static Web Project"
  • Create HTML file inside new project
  • Right click on Project -> Run as -> Run on Server -> HTTP Preview on localhost -> Finish

At this point, I keep getting NoClassDefFoundError no matter what I do.

What I already tried:

  • tried with 32/64 bit eclipse
  • with Windows XP, Windows 7
  • tried to install all the tools from "Web, XML, Java EE and OSGi Enterprise Development".
  • tried to install "Eclipse Jetty" and "Run-Jetty-Run" from the Eclipse Marketplace
  • tried different eclipse packages: "Eclipse IDE for Java developers", "Eclipse Classic"

Related questions I found:

My main environment:

  • Windows 8 64 bit
  • Eclipse Juno (4.2.2) 64 bit
  • Web Tool Platform 3.4.2
  • Jre 7

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/webapp/WebAppContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppContext at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more

+4
source share
3 answers

You can create a patch and make it work for you in the following four steps:

Phase 1 : Create a plug-in project for the plug-in you need to patch.

  • Create a new workspace (recommended) or open an existing one.
  • Choose FileImport
  • Expand Plug-in Development , select Plug-ins and Fragments , then click Next
  • Under Import As select Projects with source folders and then click Next .
  • Type (or copy and paste, no quotes) org.eclipse.wst.server.preview.adapter in the ID field at the top and click Add All . This should move this one plugin to the right pane.
  • Click Finish to import the org.eclipse.wst.server.preview.adapter file. plug-in to the project.
  • Expand the root of the project and make sure that it contains a folder named "CSI". You will only get the "src" folder if you have the "WST server" Adapter Plug-in Developer Resources ".

Phase 2 : Apply the changes needed to update the plug-in. Since there is a bug with a patch attached that can be used to apply the changes, the following steps will take advantage of that Phase 2 : Apply the changes needed to update the plug-in. Since there is a bug with a patch attached that can be used to apply the changes, the following steps will take advantage of that .

  • Open Error 402848 in the browser.
  • Click on the Patch v1.0 for 3.4.2p binding link to open the patch.
  • Starting with the second appearance of the line starting with --- , select this line at the end of the text and copy it to the clipboard. This contains changes to the PreviewLaunchConfigurationDelegate.java file in which a fix is ​​needed. You do not need the top of the patch, as this will change the version of the plugin, and this will complicate the situation.
  • In Eclipse, right-click the project "org.eclipse.wst.server.preview.adapter". Select Team and click Apply Patch .
  • Leave the clipboard selected and click Next .
  • Make sure the project is "org.eclipse.wst.server.preview.adapter" and click Next .
  • Set Ignore leading path name segments to 3. The Patch Content "should change to the blue arrow on the left instead of the red x indicators.
  • Click Finish to apply the changes.

Phase 3: Create the replacement jar. Due to the approach in Phase 1, the name of this jar will be identical to your current jar, which simplifies updating the Eclipse installation.

  • Right-click on the project org.eclipse.wst.server.preview.adapter in Project Explorer or another navigation view and select Export
  • Expand Plug-in Development , select Deployable plug-ins and fragments , then click Next
  • Click the Browse button next to the Directory option on the Destination tab, and then OK. This will set the output directory to the same as your workspace.
  • Click Finish to create a replacement plugin. It will appear in the “plugins” folder under the root of your workspace.

Phase 4: Replace the installed plug-in jar with the fixed version.

  • Close Eclipse if it is running.
  • In the plugins folder of your Eclipse installation, move or rename org.eclipse.wst.server.preview.adapter_1.1.101.v20121107_1651.jar if you do not want to overwrite it with the corrected version (mentioned in step 3 below). If you have a different version, it means that you are not using Juno SR2, and I hope you have installed the "Plugin Developer Resources for WST Server Adapters" that match your version.
  • Copy org.eclipse.wst.server.preview.adapter_1.1.101.v20121107_1651.jar from the plugins folder under your workspace and paste it into the plugins folder of your Eclipse installation.

You can now start Eclipse using a fixed plug-in. Since the corrected jar had the same version number, no further changes are required.

Hope this helps!

+2
source

Probably recorded in the upcoming Kepler release in June.

http://bugs.eclipse.org/402848

0
source
0
source

All Articles