Basic Jetty Issue
woggle23 Feb 2, 2011 10:17 AMMorning team
I've been trying to get a simple jetty example working, with a view to including it a Camel routing programme. However, I'm having significant trouble with this first step! I followed a tutorial I found on the eclipse.org site ("Jetty and Maven HelloWorld"). When attempting to build compile the project I get error messages stating:
package org.eclipse.jetty.server does not exist
package org.eclipse.jetty.server does not exist
package org.eclipse.jety.server.handler does not exist
The java class is as follows:
package org.example;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
public class HelloWorld extends AbstractHandler
{
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("h1. Hello World
");
}
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
server.setHandler(new HelloWorld());
server.start();
server.join();
}
}
The pom is as follows:
$</version> </dependency> </dependencies> <build> <plugins> <plugin> <!-- This plugin is needed for the servlet example --> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>$
The errors relate to the 3 "import org.eclipse..." statements in the java class. I was under the impression that maven downloads everything it needs automatically - clearly I'm missing something (I should mention that I'm new to Java as well). Any ideas how I resolve these issues?
Many thanks in advance.
Matt