I am using jetty6 in a simple application as a built-in servlet container. I decided to upgrade it to Jetty 8. At Jetty 6 it was pretty easy to start the server:
Server server = new Server(8080); Context context = new Context(server, "/", Context.SESSIONS); context.addServlet(MyServlet.class, "/communication-service"); server.start();
but it does not work in Jetty8. Unfortunately, I cannot find a simple example for this version. Unable to create error context
an enclosing instance that contains org.eclipse.jetty.server.handler.ContextHandler.Context is required
because now it is an inner class, and also there is no such constructor.
Most examples are for berths 6 and 7. Could you provide a simple example of how to start a servlet on pier 8?
java servlets jetty
Nullpointer
source share