Posts tagged ‘Servers’

January 26, 2011

ClassNotFoundException: org.mortbay.start.Main

by Jay Jonas

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$ Source)
at Method)
at 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:

To install the WTP Adaptor, complete the following steps.

  1. Open Eclipse.
  2. In the taskbar at the top of your screen, click Help -> Install New Software. The Available Software dialog box opens.
  3. In the Work with: field, type one of the URLs provided above.
  4. Press Return.
  5. In the Name/Version box below, select the box for Jetty WTP Adaptor Site.
  6. Click Next.
  7. The Install Details dialog box opens.
  8. Click Next again.
  9. The Review Licenses dialog box opens.
  10. Accept the terms and click Finish.
  11. 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.
  12. Click Restart Now.

Next step will be create a Jetty WTP Server.  Stay tuned as I will show it in the next post.

Tags: , ,