The Tomcat Container allows servlet 2 and 3 web applications to be run. These applications are run as the root web application in a Tomcat container.
Detection Criterion | Existence of a WEB-INF/ folder in the application directory and Java Main not detected |
Tags | tomcat-instance=⟨version⟩, tomcat-lifecycle-support=⟨version⟩, tomcat-logging-support=⟨version⟩ tomcat-redis-store=⟨version⟩ (optional) |
In order to specify Spring profiles, set the SPRING_PROFILES_ACTIVE
environment variable. This is automatically detected and used by Spring.
For general information on configuring the buildpack, refer to Configuration and Extension.
The container can be configured by modifying the config/tomcat.yml
file in the buildpack fork. The container uses the Repository
utility support and so it supports the version syntax defined there.
Name | Description |
---|---|
lifecycle_support.repository_root |
The URL of the Tomcat Lifecycle Support repository index (details). |
lifecycle_support.version |
The version of Tomcat Lifecycle Support to use. Candidate versions can be found in this listing. |
logging_support.repository_root |
The URL of the Tomcat Logging Support repository index (details). |
logging_support.version |
The version of Tomcat Logging Support to use. Candidate versions can be found in this listing. |
redis_store.connection_pool_size |
The Redis connection pool size. Note that this is per-instance, not per-application. |
redis_store.database |
The Redis database to connect to. |
redis_store.repository_root |
The URL of the Redis Store repository index (details). |
redis_store.timeout |
The Redis connection timeout (in milliseconds). |
redis_store.version |
The version of Redis Store to use. Candidate versions can be found in this listing. |
tomcat.repository_root |
The URL of the Tomcat repository index (details). |
tomcat.version |
The version of Tomcat to use. Candidate versions can be found in this listing. |
The container can also be configured by overlaying a set of resources on the default distribution. To do this, add files to the resources/tomcat
directory in the buildpack fork. For example, to override the default logging.properties
add your custom file to resources/tomcat/conf/logging.properties
.
By default, the Tomcat instance is configured to store all Sessions and their data in memory. Under certain cirmcumstances it my be appropriate to persist the Sessions and their data to a repository. When this is the case (small amounts of data that should survive the failure of any individual instance), the buildpack can automatically configure Tomcat to do so.
To enable Redis-based session replication, simply bind a Redis service containing a name, label, or tag that has session-replication
as a substring.
Additional supporting functionality can be found in the java-buildpack-support
Git repository.