Ruminations on Development
Tomcat ROOT Context
I've been fighting
with Tomcat
a bunch this week.
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 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 will update if I find that this actually does work.
Posted at 11:04AM May 11, 2008 by Nelson "Nelz" Carpentier in Java | Comments[3]
Did you find a solution to your problem in the end?
I think I'm having a similar issue!
Posted by JonB on July 28, 2008 at 07:51 AM PDT #
Hey Jon,
From what I can tell, the $CATALINA_HOME/webapps/ROOT.xml thing doesn't work.
We just ended up making an ANT task (or three) that renames the artifact to ROOT.war when it gets copied to the $CATALINA_HOME/webapps/ directory.
Yeah, it's very frustrating... :-(
Posted by Nelz on July 28, 2008 at 10:57 AM PDT #
I ended up renaming the web app file to ROOT.war too as I couldn't get any other way to work properly and I didn't want to define it in server.xml as it meant a restart of Tomcat every time I wanted to change the context.
Not ideal really but does the job!
Posted by JonB on August 03, 2008 at 02:16 PM PDT #