Bug 47343 - Fails re-deploying, when we update context.xml.
Summary: Fails re-deploying, when we update context.xml.
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.20
Hardware: PC All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2009-06-10 03:54 UTC by Keiichi Fujino
Modified: 2009-06-24 10:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Keiichi Fujino 2009-06-10 03:54:19 UTC
When context.xml of the conf/<engine>/<host>directory is updated, docBase directory is deleted and fails re-deploying. 

(The context name is assumed to be testWebapp. )
1.<<Tomcat_home>>/webapps/testWebapp/META-INF/context.xml is prepared.
2.Context.xml is not put under the conf/<engine>/<host> directory.
  (means first deployed)

3.Tomcat is started. (testWebapp.xml is created to the conf/<engine>/<host> directory. )

4.testWebapp.xml of conf/<engine>/<host > is updated. 

<<Tomcat_home>>/webapps/testWebapp directory is deleted. 

The cause is in the fixed of "http://svn.apache.org/viewvc?view=rev&revision=712464". 
The order of the resource added to HostConfig$DeployedApplication#redeployResources was changed by this fix. 

order of the redploy resources is as follows. 
[before fix]
 Case of Deploy war.
   war -> context.xml(conf/<engine>/<host>) -> doceBase directory
 Case of Deploy directory.
   doceBase directory -> context.xml(META-INF/context.xml)
[after fix]
 Case of Deploy war.
   context.xml(conf/<engine>/<host>) -> war -> doceBase directory
 Case of Deploy directory.
   context.xml(META-INF/context.xml) -> doceBase directory

HostConfig#checkResources is as follows. 
for (int i = 0; i < resources.length; i++) {
if ((!resource.isDirectory()) && resource.lastModified() > lastModified) {
   // Delete other redeploy resources
   for (int j = i + 1; j < resources.length; j++) {
       try {
           File current = new File(resources[j]);
       } catch (IOException e) {
                   ("hostConfig.canonicalizing", app.name), e);

After all,
When testWebapp.xml of conf/<engine>/<host > is updated, 
directory is deleted or war and the directory are deleted. 
As a result,
It fails in deploying because it tries to deploy it only with context.xml (docBase direcotry doesn't exist). 

Comment 1 Mark Thomas 2009-06-11 06:49:56 UTC
This has been fixed in trunk and proposed for 6.0.21
Comment 2 Mark Thomas 2009-06-24 10:40:44 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.