On 18/02/2020 23:13, Thad Humphries wrote: > On Tue, Feb 18, 2020 at 5:41 PM Mark Thomas <ma...@apache.org> wrote: >> On 18/02/2020 22:32, calder wrote: >>> On Tue, Feb 18, 2020, 14:12 Thad Humphries <thad.humphr...@gmail.com>
<snip/> >>>> However although this runs it returns a 404 on /employee. Why? >> >> There aren't (doesn't appear to be) any Servlets mapped. >> >> Are there any web applications in the appBase? >> > > There is a servlet > in src/main/java/com/example/employees, EmployeeServlet.java, with the > annotation > > @WebServlet( > name = "EmployeeServlet", > urlPatterns = {"/employee"} > ) OK. That will be relying on the StandardJarScanner finding that class - which it should. > In src/main/webapp is the file index.jsp which redirects to /employee: OK. Maven is copying that to META-INF/resources and hoping that Tomcat will treat the entire JAR as a resource JAR. That should work. > <%@ page info="sample index page" %> > <html> > <body> > <h2>Hello World!</h2> > <jsp:forward page="/employee" /> > </body> > </html> > > With Tomcat 7.0.57, I can run `java -jar > employees-app-1.0-SNAPSHOT-jar-with-dependencies.jar` in target, and load > the page at http://localhost:8888/. With Tomcat 9.0.31, I get a 404 Not sure which part is failing at this point. Using a purely static JSP without the forward and accessing /employee directly should tell you which. I'd then recommend debugging your way though the Tomcat start process to see where whichever element is failing is going wrong. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org