Skip to main content
Version: Deploy 22.1

Add Resources to a Tomcat Container

The Deploy Apache Tomcat plugin can deploy to a virtual host (tomcat.VirtualHost) or common context (tomcat.CommonContext) container. WAR files are deployed to virtual hosts, while resources such as datasources are deployed to the global Tomcat configuration, which is stored in the common context. For more information about this plugin, see Apache Tomcat plugin.

Configure a common context

To configure a common context, create it in Deploy:

  1. Go to the Explorer.

  2. Expand Infrastructure and locate the Tomcat host.

  3. Expand the host and locate the Tomcat server.

  4. On the right of the Tomcat server, click Menu button, then select New > tomcat > CommonContext.

    Add a CommonContext

  5. In the Name field, enter a name for the common context.

  6. Click Save.

    CommonContext create screen

  7. Expand Environments and open the environment where you want to add the common context.

  8. In the Containers field, add the common content.

    Adding CommonContext to an environment

  9. Click Save.

Confine resources to the common context

In an environment that contains a virtual host and a common context, Deploy will automatically map resources to both containers. To deploy resources to the common context only, you must use the tagging feature. For more information, see Use tags to configure deployments.

For example, add the tag "Common" to the common context:

Add tag to tomcat.CommonContext

Then add the same tag to a resource (for example, a tomcat.DataSourceSpec CI):

Add tag to tomcat.DataSourceSpec

When you deploy your application, during the configuration phase, Deploy will now automatically map the resource to the common context only.

For more information about the Tomcat plugin, see Apache Tomcat plugin and the Tomcat reference.