I am trying to understand how to build and run an app from local with Tomcat 9 embedded using Java 8. I've started with this example written for Tomcat 7: https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html#overview
I am able to get it to run with Tomcat 9 after a few changes to the pom.xml and one addition to the main() method: public static void main(String[] args) throws Exception { String contextPath = "" ; String appBase = "."; Tomcat tomcat = new Tomcat(); tomcat.setPort(Integer.valueOf(PORT.orElse("8888") )); // next line added for Tomcat 9 tomcat.setConnector(tomcat.getConnector()); tomcat.setHostname(HOSTNAME.orElse("localhost")); tomcat.getHost().setAppBase(appBase); tomcat.addWebapp(contextPath, appBase); tomcat.start(); tomcat.getServer().await(); } However although this runs it returns a 404 on /employee. Why? I've tried variations on other Tomcat 9 examples (such as https://nkonev.name/post/101). There main() methods are considerably more involved, and I don't follow all that's going on. I've had no success. Some don't run, or, in the nkonev example earlier, JSPs aren't processed (probably because of "tomcat.setAddDefaultWebXmlToWebapp(false);" but if I commnent that out, the Jar won't run). What's the minimum to get the above main() to serve /employee? -- "Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, *Doctor Faustus* (v. 111-13)