Search code examples
eclipsejettyeclipse-juno

Using Jetty in Eclipse Juno


As I understand, Eclipse Juno release has Jetty servlet container embedded. So I have assumed, that means I can use Jetty in Eclipse Java EE without installing any additional plugins or packages. I have tried this:

  • Created a simple dynamic Web project and run it on "J2EE Preview" Server. As a result I've got 404 error:

Error 404 - Not Found

No context on this server matched or handled this request. Contexts known to this server are: ServletTest(/ServletTest)

  • Tried to create embedded Jetty instance:

    public class Launcher {
    
        public static void main(String[] args) throws Exception {
            Server server = new Server(8080);
            server.start();
            server.join();
        }
    }
    

I am unable to find where can I import org.eclipse.jetty.server.Server class from.

What am I doing wrong?


Solution

  • Stick with your first approach. Looks like you're nearly there - you're just pinging the wrong URL. Try http://localhost:8080/ServletTest.