On 18/02/2020 22:32, calder wrote: > On Tue, Feb 18, 2020, 14:12 Thad Humphries <thad.humphr...@gmail.com> wrote: > >> 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 = "" ; >> > > May not be the issue, cause there's other code to consider, but should the > above line be > > String contextPath = "/" ;
No. "" is the correct path for the ROOT context. >> 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? There aren't (doesn't appear to be) any Servlets mapped. Are there any web applications in the appBase? Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org