tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Bowen <>
Subject Re: ROOT options -- FYI Success+Steps
Date Fri, 03 Apr 2009 17:37:14 GMT
Just to let you know that this worked out just fine.  Even though the  
renaming to ROOT.war appears easier, I'm not sure it really is.  For  
the record, I've made this work on my development machine (Mac OS X  
5.6) with Java 1.5 and Tomcat 6.0.18 (a vanilla download from Apache).
Here were my steps:

0. I stopped Tomcat.  The standard appbase is webapps. I removed ROOT  
and ROOT.war.

0a.  I restarted Tomcat andI tested the url http://localhost:8080 --  
it brings up a blank page.I stopped Tomcat again.

1. My app (myapp) was originally configured using the following  
context specification: ~myapp/META-INF/context.xml (abbreviated):

<Context debug="5" reloadable="true">
     <Resource type="javax.sql.DataSource" ...  />

2.  I created a new directory xwebapps as a sibling to webapps, and  
moved the (exploded) myapp folder into  xwebapps.

3.  I moved context.xml from xwebapps/myapp/META-INF/context to conf/ 

4.  I inserted the docBase attribute in conf/Catalina/localhost/ 
ROOT.xml as follows:

<Context docBase="../xwebapps/myapp" debug="5" reloadable="true">
   <Resource type="javax.sql.DataSource" ...  />

The relative path works because it is interpreted relative to the  
localhost appbase.

5. I restarted Tomcat, and everything works as desired:  The url http://localhost:8080 
  now brings up the myapp application.

As an experiment, I dropped a copy of the original myapp (exploded)  
folder (including META-INF/context.xml) into the standard webapps  
appbase, and restarted Tomcat.  Happily, the two versions of the app  
play nice together:  http://localhost:8080 invokes the xwebapps/myapp  
copy, and http://localhost:8080/myapp invokes the webapps/myapp copy.   
(Since they share the same db, this isn't viable for anything more  
than an experiment, but it's nice to know it works.)

Many thanks,

On Apr 2, 2009, at 11:34 PM, Caldarale, Charles R wrote:

>> From: Ken Bowen []
>> Subject: ROOT options
>> I'm wondering if I could get some pointers to reading about
>> what these options are.
> You can place a <Context> element in server.xml, but that is  
> strongly discouraged these days, and we will likely yell at you if  
> you do so.
> You can also specify the default webapp by creating the file conf/ 
> Catalina/[host]/ROOT.xml that contains a <Context> element with a  
> docBase attribute that points to a location *outside* of the <Host>  
> appBase directory.  You must also remove any ROOT.war file or ROOT  
> directory from the <Host> appBase.  If you want to have the name of  
> your .war file be different from the webapp name, this is the way to  
> do it.
> Documentation is here:
> - Chuck
> PROPRIETARY MATERIAL and is thus for use only by the intended  
> recipient. If you received this in error, please contact the sender  
> and delete the e-mail and its attachments from all computers.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message