0

I want Tomcat graceful shut down.

  • with spring boot 2.2.2 version
  • with external tomcat 9.x (not embedded tomcat)

I tried as below.

  • kill -TERM $(tomcat PID)
  • Apply spring actuator -> call localhost:8080/actuactor/shutdown
  • application.yml server:shutdown:graceful -> not working because my spring boot version is 2.2.2

None of the above three methods were gracefully shutdown. (All terminated immediately.)

How do I shutdown tomcat gracefully?

henry-jo
  • 283
  • 1
  • 3
  • 14
  • You can’t shutdown a container from the application that is running inside of it. There are some workarounds using command line commands but none of these will be graceful. – J Asgarov Apr 29 '21 at 12:38
  • Does any of these answer your question? https://stackoverflow.com/questions/8585350/does-spring-have-a-shutdown-process-to-put-cleanup-code https://stackoverflow.com/questions/36691355/how-to-gracefuly-shutdown-a-spring-boot-application-by-start-stop-daemon – Michal Krasny Apr 29 '21 at 12:42
  • If the external tomcat is installed as service, you should be able to stop it gracefully by invoking the stop method. (`service tomcat stop`, `net stop tomcat`, ...) – maio290 Apr 29 '21 at 12:42
  • How can you tell that Tomcat terminated abruptly? Don't you have a `Stopping service [Catalina]` sequence in the logs? – Piotr P. Karwasz Apr 29 '21 at 18:32

0 Answers0