2

I would like to stop Tomcat when a war deployment fails. Is there some hook or listener which could be used for that?

I know, normally one would not make the container stop when a deployment fails. In my case I would like to implement a Fail-fast error model with Tomcat since there is currently no chance to replace the WAR with a fat jar with an embedded Servlet engine (e.g., Spring-Boot).

Gerd Aschemann
  • 494
  • 5
  • 14

2 Answers2

2

In the mean time I have implemented a Tomcat LifecycleListener which shuts down TC when a deployment fails: https://github.com/ascheman/tomcat-lifecyclelistener

Thanks to Thomas Meyer who gave some hints on Twitter: https://twitter.com/thomasmey/status/752971635825729537.

Gerd Aschemann
  • 494
  • 5
  • 14
0

Spring boot provides shutdown hook. SOF has similar query as below

Spring Boot shutdown hook

This can give and idea to implement your app Fail Fast behavior with hook.

Community
  • 1
  • 1
Amit Vyas
  • 790
  • 3
  • 10