A blog about software development, primarily in Java and about web applications.

Showing posts with label auto deploy. Show all posts
Showing posts with label auto deploy. Show all posts

Thursday, September 1, 2011

Tomcat 6 and Automatic Deploy

NOTE: I'm publishing this post quickly and I haven't had the time to properly explain it here and promise to come back to this topic. I've been asked several times about this behavior so I thought was worth documenting it.

Tomcat 6 has an "Automatic Application Deployment" feature that does the following:


  • Every time a new .war file is deployed to the appBase folder (default is tomcat/webapps), tomcat automatically unpacks the new war file and generates a default Context element for it.

  • Every time a new .war file is added or the docBase folder defined in the container changes, the unpacked content within the appBase folder is undeployed and the context settings, such as the /tomcat/conf/Catalina/localhost/myapp.xml, is automatically undeployed too.



This behavior has causes me trouble. I like to leave a context xml file in the conf/Catalina/localhost directory with a docBase pointing to where I assemble/compile by war file. Each time I do a new build, the context xml file under conf/Catalina/localhost is removed.

To disable tis auto-deploy behavior, modify Tomcat's server.xml file. Within the container, set the parameter of "autoDeploy" from "true" to "false".