tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <>
Subject Re: Problem with JNDI environment entry resources
Date Wed, 03 Sep 2008 14:46:30 GMT
There's an implicit association based on the context path.  myWebApp.xml 
in conf/Catalina/localhost is implicitly associated with the webapp 
myWebApp in the webapps directory, whether it be as a .war or expanded 

Illegal may be a strong word -- it implies that tomcat will flat out 
reject the context when you define a docBase.  If there is a docBase 
attribute defined, it may be ignored if there's a webapp in the webapps 
directory matching the context name (as defined by the *name* of the 
context xml file in conf/{Engine Name}/{Host name}, not the path 
attribute of <Context ...>....</Context>).  Worse, if the name of your 
webapp in webapps is different than the name of the context xml file in 
conf/{Engine Name}/{Host name}, you can get a double-deploy.  Only one 
instance of the webapp will have the additional settings provided by the 
context xml file though.

Best practice overall is don't specify a docBase attribute unless your 
webapp is outside the appBase you are deploying the application to.  
Some people have reasons for doing this -- like when they absolutely 
have to have the war file named in some specific way that doesn't match 
the context path.  Also don't define a path attribute unless your 
<Context ... > ... </Context> element is in server.xml (absolutely NOT 


Paul Pepper wrote:
>> I'll have to check the docs again.  However, docBase is only legal when the webapp
is stored outside of the <Host>
>> appBase directory.  Otherwise, you risk ending up with double deployment.
> I don't see docBase described that way in the docs - at this moment
> I'm referring to
> Besides,
> I don't see any other documented way of associating each application
> with its associated <Context/> element within server.xml.
>>> unless I named the application ROOT, which is less than ideal
>> That is the defined mechanism for specifying the default webapp in current Tomcat
> That's one mechanism for specifying the ROOT application. Referring to
>, when
> using individual context files under
> $CATALINA_BASE/conf/[enginename]/[hostname]/:
>     "The default web application may be defined by using a file called
> ROOT.xml."
> The filename less the .xml provides the context path (/ in the case of
> ROOT) and the <Context/> element's docBase points to the ROOT
> application. This is all in accordance with the current 6.0 docs from
> my reading of them.
> I'd like to pull this out into a thread of its own on this mailing
> list. Maybe we can take this discussion there. This particular problem
> is of importance to me, and it would seem also to others judging by
> the comments left on the bug report that I referenced in my previous
> comment.
>> Placing <Context> elements in server.xml is really only there for compatibility
with older versions of Tomcat.  Personally, I'd like to see it made illegal, which would put
an end to many potential configuration errors.
> Then you'd be taking away the only mechanism (that I can see) for
> pointing to an application as ROOT, without the inelegant renaming of
> applications as ROOT.
> Paul.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message