0

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?

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Nikem
  • 5,716
  • 3
  • 32
  • 59

2 Answers2

0

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

artbristol
  • 32,010
  • 5
  • 70
  • 103
  • That is exactly what is open in my browser. As a result I get 404 as described above – Nikem Dec 10 '12 at 15:52
  • Are you following a tutorial? Does your `ServletTest` class implement the correct API to respond to a request? – artbristol Dec 10 '12 at 15:53
  • I am not following a tutorial. And I do hope my servlet is correct, having written them for the last 10 years :S But I will try to find some up-to-date tutorial for dummies for Eclipse Juno and web projects, in case I have missed something... – Nikem Dec 10 '12 at 16:00
  • @Nikem sorry, didn't mean to imply you're a noob! Feel free to update the question when you've got a bit further. – artbristol Dec 10 '12 at 16:19
  • Well, I really do seem like a noob right now :S. I have this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=379180, which describes exactly my situation. But needed libraries, mentioned in that bug, are already installed in my Juno installation. So I am still at loss here... – Nikem Dec 10 '12 at 16:46
0

There are some bugs currently in the J2EE preview which uses jetty. It seems that at this moment the Run-Jetty plugin is simply better imprelemnted...

http://code.google.com/p/run-jetty-run/

If work perfectly for my web application, just using run as run-jetty

Sergiu
  • 266
  • 3
  • 3