tomcat-deployment-listener

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 the tomcat container to abort in immediately indicate that there was an initialization error Abort tomcat when a webapp fails to deploy in Docker container Docker container best practice. Tomcat does not stop if a webapp fail to deploy and the container will continue to run. By adding this listener the tomcat will abort in case the Tomcat fails to deploy the webapp, And the container will not start. You will need to place the listener in Tomcat server.xml and set the Tomcat classpath to contain this jar

License

License

Categories

Categories

Tomcat Container Application Servers
GroupId

GroupId

com.github.yohayg
ArtifactId

ArtifactId

tomcat-deployment-listener
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

tomcat-deployment-listener
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 the tomcat container to abort in immediately indicate that there was an initialization error Abort tomcat when a webapp fails to deploy in Docker container Docker container best practice. Tomcat does not stop if a webapp fail to deploy and the container will continue to run. By adding this listener the tomcat will abort in case the Tomcat fails to deploy the webapp, And the container will not start. You will need to place the listener in Tomcat server.xml and set the Tomcat classpath to contain this jar
Project URL

Project URL

https://github.com/yohayg/tomcat-deployment-listener.git
Source Code Management

Source Code Management

https://github.com/yohayg/tomcat-deployment-listener

Download tomcat-deployment-listener

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.yohayg/tomcat-deployment-listener/ -->
<dependency>
    <groupId>com.github.yohayg</groupId>
    <artifactId>tomcat-deployment-listener</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.yohayg/tomcat-deployment-listener/
implementation 'com.github.yohayg:tomcat-deployment-listener:2.0.0'
// https://jarcasting.com/artifacts/com.github.yohayg/tomcat-deployment-listener/
implementation ("com.github.yohayg:tomcat-deployment-listener:2.0.0")
'com.github.yohayg:tomcat-deployment-listener:jar:2.0.0'
<dependency org="com.github.yohayg" name="tomcat-deployment-listener" rev="2.0.0">
  <artifact name="tomcat-deployment-listener" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.yohayg', module='tomcat-deployment-listener', version='2.0.0')
)
libraryDependencies += "com.github.yohayg" % "tomcat-deployment-listener" % "2.0.0"
[com.github.yohayg/tomcat-deployment-listener "2.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.tomcat : tomcat-catalina jar 9.0.6

test (1)

Group / Artifact Type Version
junit : junit jar 4.4

Project Modules

There are no modules declared in this project.

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.

Versions

Version
2.0.0
1.0.0