DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17970>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17970

Webapp contexts deployed twice when multi-level context path is specified

           Summary: Webapp contexts deployed twice when multi-level context
                    path is specified
           Product: Tomcat 4
           Version: 4.1.18
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When a webapp with a multi-level context path (i.e. "/tomcat/myapp" as opposed
to "/myapp") is auto-deployed by placing an xml file containing its
Context element into the appBase directory, and the server.xml file also
contains a Context element for the same webapp, Tomcat erroneously tries
to deploy the webapp twice.  This results in a slew of logged exceptions
when Tomcat attempts to deploy the second copy of the webapp using the same
context path as the first copy.

This situation happens frequently when the Tomcat admin webapp is used to
commit changes - upon commit a Context element is written to the server.xml
file for each webapp, including auto-deployed ones.  When the server is
restarted, the exceptions occur.

Code in the auto-deployer's deployDescriptors() method should catch and
silently ignore the second attempt to deploy the webapp, but the code in
that method incorrectly calculates the context path to search for by
appending the name of the xml file (minus the .xml extension) to "/".
In the case described above this results in a check to see if "/myapp"
is deployed.  Since the application was really deployed as "/tomcat/myapp"
after the server.xml file was parsed, the auto-deployer check assumes
the app has not yet been deployed and then tries to deploy a second
copy.

The right way to fix this is for the deployDescriptors() method to pull
the contextPath attribute from the Context element in the xml file and
use that to determine if the webapp has already been deployed.  I have
attached diffs for a working solution, but you may want to pull the code
for creating a Context object from an xml file into a utility class
somewhere for general use.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to