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:
- Go to the Explorer.
- Expand Infrastructure and locate the Tomcat host.
- Expand the host and locate the Tomcat server.
On the right of the Tomcat server, click , then select New > tomcat > CommonContext.
- In the Name field, enter a name for the common context.
- Expand Environments and open the environment where you want to add the common context.
In the Containers field, add the common content.
- 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:
Then add the same tag to a resource (for example, a
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.