Bug 58935 - Re-deploy from war without deleting context
Summary: Re-deploy from war without deleting context
Status: REOPENED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Manager (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement with 10 votes (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-29 03:01 UTC by bernard
Modified: 2024-07-03 16:31 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bernard 2016-01-29 03:01:45 UTC
It appears that it is not possible to re-deploy a web application while the server is running without Tomcat cleaning up the context in /conf/Catalina/localhost/.


We want in server.xml

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="false">

Currently, the context file /conf/Catalina/localhost/appName.xml is deleted on the undeploy part of the re-deploy cycle.

We do not want the deletion of this file. We want a genuine update of the application that can be executed via the manager console by just overwriting the existing .war file. Currently, the manager application requires an undeployment first which cleans up the configuration.

Or in other words, we want some means of updating the running application in a controlled fashion for production use. With controlled fashion we mean that we don't want to be exposed to the complexity that comes with autoDeploy="false". From our perspective, the manager application should have the capability to upload and overwrite an existing .war file, explode it and reload the application without deleting the context. We do not want to put the context into the war file because it contains installation specific configuration.
Comment 1 bernard 2016-01-29 03:04:20 UTC
Sorry I should have written:

With controlled fashion we mean that we don't want to be exposed to the complexity that comes with autoDeploy="true".
Comment 2 Mark Thomas 2016-01-31 11:02:49 UTC
You should be able to use the Manager text interface to do that. The update option isn't avaialble in the HTML UI. We should look at adding that.
Comment 3 bernard 2016-02-01 04:09:06 UTC
Thanks Mark for the info.

I looked again at

https://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html#Reload_An_Existing_Application

With http://host:port/manager/text/deploy?path=/mypath&update=true&war=jar:file:/tomcat/mywardr/mypath.war!/

FAIL - Deployed application at context path /mypath but context failed to start

I could not figure out how to use the update parameter in any of the commands without getting an undeploy and subsequent context xml file loss.
Comment 4 Mark Thomas 2016-02-04 10:09:45 UTC
I think the docs need fixing. Try something like this:

http://localhost:8080/manager/text/deploy?war=file:/d:/test1.war&path=/test&update=true
http://localhost:8080/manager/text/deploy?war=file:/d:/test2.war&path=/test&update=true

This works for me. It swaps between test1.war and test2.war deployed as test.war and $CATALINA_BASE/conf/Catalina/localhost/test.xml remains untouched
Comment 5 Mark Thomas 2016-02-04 12:09:32 UTC
I've updated the docs to remove the (very) out of date references to using jar:file: URLs.

The fix has been applied to 9.0.x for 9.0.0.M3, 8.0.x for 8.0.33, 7.0.x 7.0.68 and 6.0.x for 6.0.46 onwards.
Comment 6 bernard 2016-07-31 23:03:06 UTC
Thanks for the command line options. Would you please clarify in which release the update option will be available in the HTML UI. Many thanks.
Comment 7 Vinjones 2017-02-09 23:08:30 UTC
Could we have juste an option to prevent it from happening ?
So there will be no probleme of retrocompatibility.
Comment 8 Mark Thomas 2024-07-03 16:28:52 UTC
Tomcat 8 has reached End Of Life. Moving this bug to Tomcat 9.
Comment 9 Mark Thomas 2024-07-03 16:31:03 UTC
Correct component after move to Tomcat 9.