Bug 31277 - Applciation deployed twice after restart if path doesn't match war filename
Summary: Applciation deployed twice after restart if path doesn't match war filename
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Documentation (show other bugs)
Version: 5.0.28
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-17 15:12 UTC by Pete Edwards
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pete Edwards 2004-09-17 15:12:12 UTC
If you upload a war file using the HTML manager interface it places the war 
file in the webapps directory. It also extracts the context.xml file and places 
this in conf/Catalina/localhost using the war file to generate the new 
filename. So if the war file is called MyApp.war, the context file is 
MyApp.xml. So far, so good.

If the context file declares the path to be "/myapp" the application is 
deployed in the context /myapp.

Now, if you restart the server you get two instances of your application. One 
because of the MyApp.war file in webapps - this is deployed as /MyApp. The 
second is due to the context file (MyApp.xml) but this deploys as /myapp.

I don't know what the correct behaviour should be but the restriction is that 
your path must be the same as the war filename.
Comment 1 Yoav Shapira 2004-09-17 15:27:37 UTC
Turn off autoDeploy and this won't happen.  It's not a Tomcat bug, merely a 
configuration issue.
Comment 2 Pete Edwards 2004-09-20 09:38:52 UTC
I did have the flag autoDeploy set to false but your comment pointed me in the 
right direction. The flag that needs turning off is in fact deployOnStartup. So 
the host element needs to be:
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="false" 
autoDeploy="false" deployOnStartup="false">

I think there is still an issue around the documentation. The help on Automatic 
Application Deployment is misleading (http://jakarta.apache.org/tomcat/tomcat-
5.0-doc/config/host.html#Automatic%20Application%20Deployment).

1. I think the first action happens even when deployOnStartup is false - I 
didn't try this attribute because I thought it would stop things deploying on 
startup but it doesn't. Actually it solves the problem I was having by only 
deploying things from context files in 
$CATALINA_HOME/conf/[engine_name]/[host_name], but doesn't deploy things from 
appBase.
2. Should the second action read "Any web application archive file <ins>within 
the application base directory</ins> that does not have a corresponding 
directory of the same name..."
3. The paragraph starting "In addition to the automatic deployment" doesn't 
mention the attribute "autoDeploy" but I think this is what it is referring to.
4. The last paragraph starting "When using automatic deployment," doesn't 
reflect the fact that if you upload a war file, the docBase attribute is 
ignored and the file goes in the appBase directory. Hence you get double 
deployment on restart unless you disable deployOnStartup

I accept that this was in fact a configuration issue but hopefully the 
documentation can be made clearer.

Thanks
Comment 3 Yoav Shapira 2004-09-20 18:31:13 UTC
OK, doc clarified (for 5.0.29 and 5.5.3).