Tomcat + Apache Overlap

One of the small puzzles after getting mod_jk2 working, is with enabling JSP pages using Tomcat while serving everything else through Apache is how to get Tomcat and Apache to use the same directory mappings. If Apache has a mime-type set for JSP files content negotiation works on them as well.

First, in Tomcat's "server.xml" file, in the Host tag, add the following tag, I put it at the top of the Host tag

<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html"
userClass="org.apache.catalina.startup.PasswdUserDatabase" />

Second, change the ROOT context of the host to match the document root of Apache, "/var/www/localhost/htdocs" in my case

<!-- /etc/tomcat5/Catalina/localhost/ROOT.xml -->
<Context path="" docBase="/var/www/localhost/htdocs" debug="0" />

If there are aliases which must also be mapped, create contexts for them as well

Finally, both the users that Apache and Tomcat run under must have access to read all the web content they are going to server