Tomcat doesn't stop. How can I debug this?
If the web application is stopped, all connections to the database should be closed as well. If you don't have a list of connections, then execute the SQL statement "shutdown" (this only works for the H2 and HSQLDB databases).
If you have a registered a Servlet, you can do that in the Servlet.destroy()
method.
If you have registered a ServletContextListener
, you can execute the "shutdown" statement in the ServletContextListener.contextDestroyed(ServletContextEvent servletContextEvent)
method. This is what org.h2.server.web.DbStarter
ServletContextListener
does (the one that is included in the H2 database).
Tomcat won't stop or restart
It seems Tomcat was actually stopped. I started it and it started fine. Thanks all.
Not able to stop the tomcat server in linux
I found the way to kill the server, first I found its process Id using : ps -eaf | grep tomcat
then killed the required process using its processId by : kill -9 *ID*
Should threads have special design to be shutdown gracefully by Tomcat?
... and to tie the other responses to the workings of Java Servlet environments;
if you don't declare your threads as daemon threads, the way to signal the server shutdown to the threads is to implement a ServletContextListener
and configure it to your web application (web.xml). When Tomcat is shutting down, it will first shut down each application, which in turn will cause contextDestroyed()
method of the listener to be called - and this is where you can signal your own threads that they should finish their work.
Related Topics
Error:(23, 17) Failed to Resolve: Junit:Junit:4.12
Understanding Metaspace Line in Jvm Heap Printout
How to Create Native Binaries for Your Java App
Windows: Moving a File That Was Previously Mapped in Memory Fails
How to Set Classpath in Linux to Let Java Find Jar File
Why the Operating System Says It Can't Allocate Memory to Jvm When It Has Enough Memory
How to Fix Java.Awt.Headlessexception in Jenkins on Linux
Illegal Pattern Character 'T' When Parsing a Date String to Java.Util.Date
Conversion to Dalvik Format Failed: Unable to Execute Dex: Java Heap Space
Android N Change Language Programmatically
Getting Unwanted Characters When Reading Command Output from Ssh Server Using Jsch
Swt Browser No More Handles Error
How to Run Sudo Command Without Password from Java Program
How to Solve the 'Lock Obtain Timed Out' When Using Solr Plainly
Why Is Alternatives Command Used When Installing Java on a Linux MAChine
In Java, "5/0" Statement Doesn't Fire Sigfpe Signal on My Linux MAChine, Why