How To Nest (Independent) Web Apps in Tomcat

October 19th, 2005

On my current project, we needed to nest Tomcat web apps, similar to:

  http://domain.com/top
  http://domain.com/top/nested

Where “top” and “top/nested” are independent web apps .

Unfortunately, specifying a nested context path in webapps/nested/META-INF/context.xml does not work; neither does physically nesting the web app directories.

What does work is to specify the context for nested in TOMCAT/conf/server.xml. The individual web apps directories remain peers in the webapps directory, as such:

TOMCAT/webapps/nested/
TOMCAT/webapps/top/

and thus may be deployed (and maintained) independently. Problem solved.

One Response to “How To Nest (Independent) Web Apps in Tomcat”

  1. magomarcelo Says:

    found this:

    http://mail-archives.apache.org/mod_mbox/tomcat-users/200511.mbox/%3CAEF3D568DD1D9E428048C592AA16459702E09FD6@USRV-EXCH4.na.uis.unisys.com%3E

    and I can confirm it works, in your case you would have a context file named:
    TOMCAT/conf/Catalina/domain.com/top#nested.xml