Skip to Main Content
Tomcat: The Definitive Guide, 2nd Edition
book

Tomcat: The Definitive Guide, 2nd Edition

by Jason Brittain, Ian F. Darwin
October 2007
Intermediate to advanced content levelIntermediate to advanced
496 pages
16h 50m
English
O'Reilly Media, Inc.
Content preview from Tomcat: The Definitive Guide, 2nd Edition

Hot Deployment

If you need to deploy and undeploy your webapp without needing to restart the Tomcat JVM in order for the deployment and undeployment to take effect, you want "Hot Deployment." In this section, we focus on local filesystem hot deployment, where everything happens on one machine, as opposed to remote hot deployment, where you hot deploy a webapp from one machine to another machine running Tomcat. For remote hot deployment, you should use the Manager webapp, detailed later in this chapter.

In the "Hosts" section, earlier in this chapter, we showed you how to configure your Host for hot deployment (explicitly set autoDeploy="true" and deployOnStartup= "false" on your Host). Once you have that set, you may hot deploy your webapps into that Host in the following ways:

  • Create a <Context> container XML element in your server.xml file, nested within the Host that has hot deployment enabled.

  • Copy your web application's WAR file into your hot deployment-enabled Host's appBase and Tomcat will deploy it and start it up.

  • Create a context XML fragment file that points to the webapp's unpacked directory or WAR file and drop the context XML fragment file into the CATALINA_HOME/conf/[EngineName]/[HostName]/ directory.

If you're not placing a context XML fragment file in the CATALINA_HOME/conf/[EngineName]/[HostName]/ directory, and your webapp contains a META-INF/context.xml file, that context.xml file will be read and used by Tomcat (again, make sure you do not set deployXML="false"

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Apache Tomcat 7

Apache Tomcat 7

James Goodwill, Aleksa Vukotic
Java Servlet Programming, 2nd Edition

Java Servlet Programming, 2nd Edition

Jason Hunter, William Crawford

Publisher Resources

ISBN: 9780596101060Supplemental ContentErrata