Setting autoDeploy and deployOnStartup will cause

2019-05-06 20:37发布

问题:

I'm reading "Tomcat 6 Developer's Guide" written by Damonar Chetty, and in the host chapter he says:

Setting both to true will cause an application to be deployed at startup, and then again once Tomcat is up and running. As a result, ensure that you set at least one of these to false to avoid redundant deployment of the same web application.

So, I set autoDeploy, deployOnStartup and unpackWARs to true, then put a war into the APPBASE folder and debug the deploy process, but tomcat just deploys the war in reponse to the host's start event. No deployment occurs in the periodic event of autoDeploy. I think this is because nothing ever changed after the first deployment, and what Demonar Chetty says is not right.

What's your opinion?

回答1:

Yes it does.

If you add Conext element in server.xml, and set autoDeploy="true", tomcat will do deployment twice.

you can just set autoDeploy="false" or remove the context element in server.xml.