I created a simple servlet that I want to deploy to Jetty 7.2. Jetty works and can serve JSP pages at http://localhost:8080/jonas/test.jsp . I started Jetty with the java -jar start.jar .
I saved the compiled servlet MyServlet.class to <my_jetty_directory>/webapps/jonas/WEB-INF/classes/MyServlet.class and then tried to access this servlet at http://localhost:8080/jonas/servlets/MyServlet , but I got an HTTP 404 error.
HTTP ERROR 404 Problem accessing /jonas/servlet/MyServlet. Reason: Not Found
Is there anything else I need to do? Where in the Jetty file structure should I place MySerlvet.class ?
Now I created a simple web.xml and saved it in <my_jetty_directory>/webapps/jonas/WEB-INF/web.xml and restarted my Jetty, but it does not work. Here is my simple web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app> <servlet> <servlet-name>MyServlet</servlet-name> <servlet-class>MyServlet</servlet-class> </servlet> </web-app>
I had a similar problem with JSP, which is now resolved: How to deploy a JSP file on a Jetty web server?
source share