Custom Tomcat Configuration for Java Components

Developers can configure a custom Tomcat configuration for Java Web Application workloads on a per-component basis by including a context.xml file in their application archive.

The context.xml file should be included next to the packaged .war file in the individually named folder within the “wars” folder in the archive.  When Java workloads configured in this manner are deployed on the Platform, anything included within the following tags in the context.xml file will be injected into {instanceroot}/conf/context.xml for deployed workloads:

  • Environment
  • JarScanner
  • Listener
  • Loader
  • Manager
  • Parameter
  • Realm
  • Resource
  • ResourceLink
  • Resources
  • Transaction
  • Valve
  • WatchedResource

Sample context.xml file included with the application archive

  <Resource name="mail/Session"
    type="java.mail.Session""localhost" />


Sample context.xml file located in the “conf” folder of the deployed workload

  <Resource name="mail/Session"auth="Container" type="java.mail.Session""localhost">

While Developers can also include this configuration within the structure of their .war at META-INF/context.xml, the alternate method outlined above allows for more flexibility in configuration that does not rely on regenerating an entirely new .war.