I was trying to set up Eclipse to run and deploy my projects to a Jetty 7 server. I have downloaded it and unpacked it, and I installed the Jetty plugin from the available server adapters list, but when I try to configure a new Jetty server, the server type list only contains “Jetty 6”. If I use this and point it at my server runtime, when I try to start it I get the following error:
java.lang.NoClassDefFoundError: org/mortbay/start/Main Caused by: java.lang.ClassNotFoundException: org.mortbay.start.Main 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) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Exception in thread "main"
The problem is that the package name changed with the migration from Codehaus to Eclipse. So, we need a new WTP Adaptor for Jetty 7.x/Jetty 8.x that can be downloaded from the update sites as follows:
- Stable releases of the plugin:
- Bleeding edge versions of the plugin:
To install the WTP Adaptor, complete the following steps.
- Open Eclipse.
- In the taskbar at the top of your screen, click Help -> Install New Software. The Available Software dialog box opens.
- In the Work with: field, type one of the URLs provided above.
- Press Return.
- In the Name/Version box below, select the box for Jetty WTP Adaptor Site.
- Click Next.
- The Install Details dialog box opens.
- Click Next again.
- The Review Licenses dialog box opens.
- Accept the terms and click Finish.
- The Installing Software dialog box opens, displaying progress for installing the WTP adaptor. When it completes, the Software Updates dialog box opens with a message that you need to restart Eclipse to complete the installation.
- Click Restart Now.
Next step will be create a Jetty WTP Server. Stay tuned as I will show it in the next post.