Tomcat supports several deployment methods to suit different workflows and environments. AutoDeploy watches theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apache/tomcat/llms.txt
Use this file to discover all available pages before exploring further.
webapps directory and deploys applications as they arrive on the filesystem. The Manager application provides an HTTP-based remote deployment interface for both interactive and scripted use. Context descriptor files offer fine-grained control over application configuration, and parallel versioned deployments allow gradual traffic migration without dropping user sessions.
autoDeploy
TheautoDeploy feature instructs Tomcat’s HostConfig listener to periodically scan the appBase directory for new or updated WAR files and directories, deploying them automatically. This is the default behavior in a standard Tomcat installation.
The relevant <Host> attributes in conf/server.xml are:
| Attribute | Default | Description |
|---|---|---|
appBase | webapps | Directory (relative to $CATALINA_HOME) scanned for deployable applications |
autoDeploy | true | Continuously scan appBase for new/changed WARs and directories |
deployOnStartup | true | Deploy applications found in appBase when Tomcat starts |
unpackWARs | true | Unpack WAR files to directories before serving |
| Filename | Context Path | Notes |
|---|---|---|
ROOT.war | / | The root application |
myapp.war | /myapp | Standard mapping |
myapp##1.0.war | /myapp (version 1.0) | Parallel deployment version |
api##2.1.war | /api (version 2.1) | Multiple versions co-exist |
appBase directory using a background thread. The scan interval is controlled by the backgroundProcessorDelay attribute on the <Engine> or <Host> element (in seconds, default: 10).
Exploded Directory Deployment
Instead of a WAR archive, you can drop an unpacked application directory directly intoappBase. The directory is treated identically to a WAR: the same filename-to-context-path rules apply, and Tomcat will hot-pick it up when autoDeploy="true".
META-INF/context.xml
An application can bundle its own context configuration by including aMETA-INF/context.xml file inside the WAR or exploded directory. This file uses the same <Context> schema as Tomcat’s external context descriptors.
On the first deployment, Tomcat copies
META-INF/context.xml to conf/Catalina/<hostname>/<appname>.xml and uses that copy for all subsequent starts. Changes to META-INF/context.xml inside the WAR are not picked up automatically after the initial copy. To update the context configuration, edit the file in conf/Catalina/<hostname>/ directly, or undeploy and redeploy the application.Static Context Configuration
You can pre-configure an application’s context before it is deployed by placing a descriptor file at:/myapp on localhost:
META-INF/context.xml inside the application and is never overwritten by Tomcat. A minimal static descriptor looks like:
docBase attribute can point outside appBase, which is useful when the application files live on a separate volume.
Deployment via Manager App
The Tomcat Manager application exposes an HTTP text API for deploying WARs directly from the filesystem or by uploading them over HTTP. See Manager App for full configuration details. Deploy a WAR from a server-side path:Undeploy and Reload
Undeploy removes the application from the running server and (if the WAR or directory was deployed via Manager) deletes it fromappBase:
Parallel Deployment (Multiple Versions)
Tomcat supports deploying multiple versions of the same application simultaneously using the## version separator in the WAR or directory name:
- New sessions are routed to the highest version number.
- Existing sessions continue to be served by the version they were established against.
- Old versions are gracefully drained as sessions expire.
Application Isolation and Class Loading
Each deployed context receives its ownWebappClassLoader instance. This means:
- Applications cannot access each other’s classes or libraries placed in
WEB-INF/lib. - Different versions of the same library (e.g., different Guava releases) can coexist in separate applications without conflict.
- Classes are loaded in the order: Bootstrap → System → Common → Webapp (by default).
$CATALINA_HOME/lib. Libraries intended for a single application belong in WEB-INF/lib.
For advanced class-loading configuration, including overriding the parent-first delegation model, see Class Loading.