This is documentation for Apprenda 7 and 8.
Documentation for newer version is available at https://new.docs.apprenda.com.

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

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

 

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

	<Context>
	  <WatchedResource>WEB-INF/web.xml</WatchedResource>
        ...
	  <Resource name="mail/Session"auth="Container" type="java.mail.Session" mail.smtp.host="localhost">
	  </Resource>
        ...
	</Context>

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.