The larger your Servlet application becomes the more time it needs to start. The same thing happens with the time it takes to stop an application.
By default a Tomcat server gives an application 5 seconds to terminate before the “Tomcat did not stop in time. PID file was not removed.” messages is logged. 5 seconds isn’t a lot of time, especially when the application needs to close a connection pool or perform some cleanup tasks.
The fix is rather easy and documented in the catalina command:
|
|
Adding a timeout parameter to the shutdown command will give your application the time it needs to perform a clean shutdown. I’ve added the following line in the deamon script (/etc/init.d/tomcat). And the “Tomcat did not stop in time” messages disappeared: