Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 2.64 KB

readme.md

File metadata and controls

60 lines (38 loc) · 2.64 KB

Tomcat listener will abort Tomcat process when a webapp fail to deploy

Maven Central Build Status Coverage Status License: MIT Maintainability Docker Automated build Javadocs

Description

According to Docker best practices a Docker container should not be up if the process fails to load properly.

Apache Tomcat deploys all the web applications loaded in its webapp folder. This is a resilient solution for web applications not influencing the application server.

However, In a Docker environment according to best practice, the process should fail in case the web application failed to initialize properly.

By adding the additional jar created by this project to Tomcat classpath and adding the new listener in the Tomcat conf/server.xml the user can make sure the Tomcat process fails in case there is an initialization exception in their web application which will cause the Tomcat used in the tomcat container to abort, and immediately indicate that there was an initialization error.

Usage

Mount the jar in the tomcat classpath and add to server.xml:

<Listener className="org.apache.tomcat.deployment.listener.StrictStateCheckListener" />

Example

See Dockerfile:

build:

docker build -t yohayg/tomcat-deployment-listener:3.0.0 .

run:

docker run -it --rm -p 8080:8080  yohayg/tomcat-deployment-listener:3.0.0

Versions:

1.x.x - Supports tomcat7

2.x.x - Supports both tomcat8 and both tomcat9

License

This project is licensed under MIT license.