My specific challenges have been around configuring a webapp to have the context root of "/", without having to name it ROOT.war…
The documentation page on context configuration says that "Context elements may be explicitly defined":
- in the $CATALINA_HOME/conf/context.xml file- the Context element information will be loaded by all webapps
- in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file- the Context element information will be loaded by all webapps of that host
- in individual files (with a .xml extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml.
- if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files
- inside a Host element in the main conf/server.xml
In my experience this week, the option of creating the file $CATALINA_HOME/conf/[enginename]/[hostname]/ROOT.xml didn’t work for me.
But, one of my coworkers (Chris) found some other resource somewhere that said you could create a $CATALINA_HOME/webapps/ROOT.xml that looked like this:
<?xml version='1.0' encoding='utf-8'?> <Context docBase="/absolute/path/to/your/webapp/dir"> </Context>
Chris tried this setup, and it seemed to work for him. Here’s my caveats:
- I haven’t verified this myself yet.
- I’m not sure if it has to be an exploded WAR file structure, or if it can be a WAR file itself.
I will update if I find that this actually does work.