I would like to start with Java web development. First I would like to setup a good development environment using an Jetty server in Eclipse, which would allow for short development cycles. But I am struggling to set it up.
There are other questions about it, but they are either old or incomplete for me. I have seen suggestions for using a plugin, but the plugins seem to be out of date. Also I don't wont to be requierd to use Maven at the beginning.
I have seen ways to set up Jetty in Eclipse without an plugin:
But for me as a novice on server-side Java and Jetty, they are incomplete.
I followed the steps in the linked article. But on step 2 I don't know what content web.xml
should have, I created an empty XML file. And when I try to run the server on step 4 I get java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppContext
How do I setup Jetty with Eclipse without plugin?
UPDATE
As waxwing suggested, I should change the class since it has changed from Jetty 6 to Jetty 7. I started the Jetty server again and now I get NoSuchMethodException
:
2010-07-25 13:37:22.849:WARN::Config error at <Set name="var">../sampleweb/sampleweb_webroot</Set> java.lang.NoSuchMethodException: class org.eclipse.jetty.webapp.WebAppContext.setVar(class java.lang.String)
2010-07-25 13:37:22.849:WARN::Unable to reach node goal: started
java.lang.NoSuchMethodException: class org.eclipse.jetty.webapp.WebAppContext.setVar(class java.lang.String)
My sampleweb.xml
that is placed in the context
directory in my Jetty project and has this content, taken from the article:
<?xml version="1.0" encoding="UTF-8"?>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/app</Set>
<Set name="var">../sampleweb/sampleweb_webroot</Set>
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultDescriptor">
<SystemProperty name="jetty.home" default="."/>
/etc/webdefault.xml</Set>
</Configure>
I would likte to set up a simple Hello World servlet.