Home:ALL Converter>Running Jetty 7 server in eclipse?

Running Jetty 7 server in eclipse?

Ask Time:2010-03-10T17:39:04         Author:user264636

Json Formatter

I'm trying to set up Eclipse to run and deploy my projects to a Jetty 7 server (the oldest version available from http://download.eclipse.org/jetty/). I've downloaded Jetty 7 and unpacked it, and I've 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" 

I'm guessing I need a different adaptor to start Jetty 7, but I have no idea where to find it.

Author:user264636,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/2415803/running-jetty-7-server-in-eclipse
Dimas Kotvan :

Better than using the WTP adapters I prefer to use an embedded jetty.\nI just create a regular java project, let's call \"embedded-jetty\". I make the original webapp project a requirement to this project in the Projects section of the \nJava Build Path of the project properties. Than I create a class that start a jetty instance like this:\n\nimport org.eclipse.jetty.server.Server;\nimport org.eclipse.jetty.webapp.WebAppContext;\n\npublic class JettyServer {\n public static void main(String[] args) {\n Server server = new Server(8080);\n\n WebAppContext context = new WebAppContext();\n context.setResourceBase(\"../webapp-project/WebContent\");\n context.setDescriptor(\"../webapp-project/WebContent/WEB-INF/web.xml\");\n context.setContextPath(\"/\");\n context.setParentLoaderPriority(true);\n server.setHandler(context);\n\n try {\n server.start();\n server.join();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n}\n\n\nOn the embedded-jetty project I create a \"lib\" folder and copy all the libs from the jetty/lib folder, then I add the libs on the Libraries of the project properties.\n\nRunning and debugging the jetty embedded works great for me, the jsp and class reloading works like a charm ",
2010-05-28T18:36:42
Thomas Broyer :

There's a new (official!) Jetty WTP Plugin supporting Jetty 7.x and 8.x: http://wiki.eclipse.org/Jetty_WTP_Plugin",
2010-11-24T17:12:41
Thorbjørn Ravn Andersen :

The problem is that the package name changed with the migration to Eclipse, and the Jetty folks are still busy.\n\nYour easiest option is to download Jetty 6 from Codehaus (http://dist.codehaus.org/jetty/), unpack it somewhere and use the Jetty 6 adapter.",
2010-03-10T10:19:21
TonyQ :

Run-Jetty-Run Eclipse plug-in have well support for both Jetty7 and Jetty 8 , \nand easier to use then WTP Eclipse for me .\n\nIt's worth to try it. :)\n\nhttp://code.google.com/p/run-jetty-run/",
2011-12-19T16:07:24
yy