Bug 50441 - It is not possible to have multiple instacnes of same docBase inside appBase
Summary: It is not possible to have multiple instacnes of same docBase inside appBase
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 05:18 UTC by Ognjen Milic
Modified: 2013-03-17 04:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ognjen Milic 2010-12-09 05:18:13 UTC
When I set docBase in context tag to relative path it is not possible to have more then one Context with same docBase. For example

We have two XML files for our application in folder Catalina/localhost.
iis.xml and iisstampa.xml. Both of them have the same docBase="iis".
appBase is set to webbaps in Host tag in server.xml.

iis.xml is loaded corectly, but iisstampa.xml is not. This is because inside of method org.apache.catalina.startup.HostConfig.deployDescriptor there is part that recognizes that {tomcat_home}/webapps/iis folder is inside of appBase an docBase attribute is ignored by calling context.setDocBase(null). This causes Tomcat looks for folder iisstampa inside of appbase which of course does not exist.

If we put this context and docBase outside appBase everything works corectly.

But described situation is in conflict with documentation because it is not possible to have multiple instances of same docBase if the docBase is inside appBase.

This behavour is introduced in revision SVN 303926 of Tomcat 5.5 by remm (Remy Maucherat) as a solution of bug 34840 to recognize if the context path is external.

This bug exists on Tomcat 7 also.

We experinced this bug during migration from tomcat 5.5.4 to Tomcat 6 so this is reason reporting in Tomcat 6 section.
Comment 1 Mark Thomas 2010-12-09 05:25:53 UTC
This is working as designed. If you need further assistance, please use the users mailing list.
Comment 2 Ognjen Milic 2010-12-09 05:49:54 UTC
(In reply to comment #1)
> This is working as designed. If you need further assistance, please use the
> users mailing list.

But in documentation for Context tag it is written

The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host.

If I have only one xml file in example above called iisstampa.xml with docBase=iis.
Message A docBase /home/programi/tomcat/webapps/iis inside the host appBase has been specified, and will be ignored. Then Tomcat looks for folder iisstampa under webapps folder which does not exist and the context is not loaded.

So there is no possibility to have docBase set relative to appBase because every relative path is ignored.
Comment 3 Mark Thomas 2010-12-09 06:22:09 UTC
Patches to the documentation are welcome.
Comment 4 Mark Thomas 2011-01-20 15:43:31 UTC
I have updated the docs. The update will be included in 7.0.7 onwards.
Comment 5 Konstantin Kolinko 2013-03-17 04:57:38 UTC
The documentation patch has been applied to Tomcat 6 as well, along with further clarifications added later. It will be in 6.0.37.