Bug 34840 - updating war - tomcat removes mycontext.xml
updating war - tomcat removes mycontext.xml
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.9
PC Linux
: P2 normal with 1 vote (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
: 34866 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-05-10 15:12 UTC by Gernot
Modified: 2005-08-26 10:23 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gernot 2005-05-10 15:12:22 UTC
I've a new installed tomcat and placed mycontext.xml (conf/Catalina/localhost):
<Context docBase="/somewhere/somewhat.war" />

After updating somewhat.war tomcat removes mycontext.xml! So the application
will not be deployed correctly.

The tomcat docs
("tomcat-docs/config/host.html#Automatic%20Application%20Deployment") says:
"An update to a WAR which has been expanded will trigger an undeploy (with a
removal of the expanded webapp), followed by a deployment"
Comment 1 Remy Maucherat 2005-05-10 20:23:57 UTC
I don't think this use case will be handled, sorry. I'll likely mark this as
wontfix.
Comment 2 Remy Maucherat 2005-05-10 20:42:09 UTC
Updating the war means you want to fully redeploy. Your war doesn't contain the
context.xml, so no redeployment occurs. You should drop the .xml again after the
war update in this case. Sorry, there's no other solution (doing otherwise would
break other cases), this is not a bug.
Comment 3 Remy Maucherat 2005-05-10 20:42:26 UTC
Updating the war means you want to fully redeploy. You should drop the .xml
again after the war update in this case. Sorry, there's no other solution (doing
otherwise would break other cases), this is not a bug.
Comment 4 Remy Maucherat 2005-05-11 16:44:17 UTC
*** Bug 34866 has been marked as a duplicate of this bug. ***
Comment 5 Martin Kuba 2005-05-11 16:54:44 UTC
(In reply to comment #4)
> *** Bug 34866 has been marked as a duplicate of this bug. ***

But I don't want to have the context.xml packed inside the WAR,
because I use the context XML for defining init parameters which are
machine-specific, i.e. which are not part of the web application, they are
rather deployment-time parameters.

Forcing to pack context descriptor *inside* of the webapp breaks the division of
author and deployer, as described by SUN in the blueprintsfor J2EE.
Comment 6 Remy Maucherat 2005-05-12 11:45:21 UTC
Martin: your problem is not really related, please don't reopen the report.

Gernot: I think I have found a way to tweak the order of the resources so that
the behavior is better. I found it is possible as Tomcat will never remove any
resources which are not inside the Host appBase, so in this case it works well
to put the context file first (so it is never removed when a less relevant
resource - such as the WAR - is updated). Hopefully, I didn't get it wrong.
Comment 7 Remy Maucherat 2005-06-16 11:39:38 UTC
*** Bug 34866 has been marked as a duplicate of this bug. ***
Comment 8 Paul Austin 2005-08-17 19:48:02 UTC
I am also experiencing this problem when I use the start/stop deployer commands
which worked in version 5.5.7. My normall pattern was to stop the application,
then copy an updated war file then start the application.

With version 5.5.9 it deletes the <context>.xml file from the
conf\Catalina\<host> directory for that context when it is stopped, so I can't
start it again.

I guess for a redeploy case I should be using undeploy/redeploy which I am not,
but what about the case where I want to take the application offline say for a
database backup, there is now not a way to start the application again as it
can't find the context.

Also I agree with the other comments that I don't want to define my data sources
within the war file I want to use a per server configuration. I know that I can
always modify the war file after it has been created with the context file
before deploy but that would just be one extra step for someone to forget.

Paul
Comment 9 Remy Maucherat 2005-08-26 18:23:46 UTC
Please do not reopen the report.