Trying to get a Tomcat 7 application off the ground and know a couple of things:
In earlier versions of Tomcat the content of a Context Descriptor configuration was often stored within Tomcat's primary configuration file server.xml but this is now discouraged (although it currently still works).
The locations for Context Descriptors are: $CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml $CATALINA_BASE/webapps/[webappname]/META-INF/context.xml
So here is the way our apps are laid out (non-negotiable):
Tomcat + WAR: /some/dir/MyApp/* some/dir/MyApp/webapps
LOGS: /some/other/dir/logs/MyApp/
After the app starts with no errors I make requests for:
http://foo/static/index.html
When I define the context in $CATALINA_HOME/conf/server.xml everything is beautiful:
<Host name="localhost" appBase="webapps"
unpackWARs="false" autoDeploy="true">
<Context path="/" docBase=“MyApp.war" />
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="/some/other/dir/logs/MyApp"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
Now to avoid putting the context in server.xml here are a couple of things i tried. I removed the context from server.xml then created a $CATALINA_HOME/conf/Catalina/localhost/MyApp.xml file.
<Context
docBase=“/some/dir/MyApp/webapps/MyApp.war"
path=""
reloadable="false"
swallowOutput="true"
sendRedirectBody="true"
>
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_access_log." suffix=".txt"
pattern="common"/>
</Context>
-->FAIL: 13/Jun/2014:17:03:53 -0700] "GET /static/index.html HTTP/1.1" 404 -
-->MyApp.log: A docBase /some/dir/MyApp/webapps/MyApp.war inside the host appBase has been specified, and will be ignored
Next I tried removing the context from server.xml, deleting $CATALINA_HOME/conf/Catalina/localhost/MyApp.xml, but creating $CATALINA_HOME/conf/context.xml:
<Context>
path = ""
docBase=“MyApp.war"
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
—>FAIL: 13/Jun/2014:17:03:53 -0700] "GET /static/index.html HTTP/1.1" 404 -
I tried the above context.xml with and without the path, and docBase defined with both producing the same 404.
What am I missing?