Tomcat Failstop LifecycleListener

Tomcat LifecycleListener to shut down/exit Tomcat on a failed deployment. Cf. README and JavaDoc for further information.

License

License

Categories

Categories

Tomcat Container Application Servers Net
GroupId

GroupId

net.aschemann.tomcat
ArtifactId

ArtifactId

tomcat-lifecyclelistener
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Tomcat Failstop LifecycleListener
Tomcat LifecycleListener to shut down/exit Tomcat on a failed deployment. Cf. README and JavaDoc for further information.
Project URL

Project URL

https://github.com/ascheman/tomcat-lifecyclelistener.git
Source Code Management

Source Code Management

https://github.com/ascheman/tomcat-lifecyclelistener/tree/master

Download tomcat-lifecyclelistener

How to add to project

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

Dependencies

provided (1)

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

Project Modules

There are no modules declared in this project.

Tomcat Failstop Lifecycle Listener

Build Status

This component contains a Java class implementing the Tomcat Lifecycle Listener to shut down or exit Tomcat on a failed deployment.

Add it to Tomcat:

  • Download tomcat-lifecyclelistener.jar and put it into the ${catalina.base}/lib directory
  • Extend the configuration within the context.xml as
    <!-- Stop on failed deployments:
         - Set "force" to just perform a "System.exit" of the server JVM
         - Otherwise enable call to shutdown port, optionally
           - set port (default: 8005) and shutdown password (default: SHUTDOWN) as in server.xml
           - set waitForStart (default 30s) to make the shut down command wait until TC is completely up and running
    -->
    <Listener className="net.aschemann.tomcat.lifecycle.FailstopLifecycleListener" />

The listener will send a SHUTDOWN password to Tomcat's 8005 port and Tomcat will try to make a gracefully shutdown. The port and password are configured in ${catalina.base}/conf/server.xml file like this:

    <Server port="8005" shutdown="SHUTDOWN">

For security reasons port and the shutdown password may be changed so you can override it as well as other defaults:

    <Listener className="net.aschemann.tomcat.lifecycle.FailstopLifecycleListener" port="29821" 
        shutdown="Hasta la vista, baby!" waitForStart="20" />

Or if you need to exit without gracefully shutdown you can use the force attribute:

    <Listener className="net.aschemann.tomcat.lifecycle.FailstopLifecycleListener" force="true" />

Optionally you can also add the library to your app's pom.xml:

<dependency>
    <groupId>net.aschemann.tomcat</groupId>
    <artifactId>tomcat-lifecyclelistener</artifactId>
    <version>1.0.1</version>
    <scope>provided</scope>
</dependency>

Thus you'll be able to debug the FailstopLifecycleListener class.

Versions

Version
1.0.1