Reputation: 805
I have searched and searched and hoping someone can assist me with this issue.
Currently we have an Apache Tomcat Server running on a local Windows 2008 Server. At times Tomcat locks up and causes the website to not respond.
We have monitoring (C# Console Application) in place to automatically go in and turn the Apache Tomcat Service off then turn it back on. Which actually resolves the issue.
However, the programming group is requesting a us to actually get the Apache Tomcat Thread Dump before we restart the service.
So the question is - How do I get the apache tomcat thread dump via Command Prompt or via C# so I can save the thread to a file.
Upvotes: 1
Views: 291
Reputation: 7196
Start your Tomcat with the following parameters:
-Dcom.sun.management.jmxremote.port=<some free port>
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
After Tomcat is started, you can easily use jconsole or some other tool to get dump out of it.
Or, if you just want to use command prompt, use below commands, but for this you need to have JDK:
jps (it will give you the process id)
Now you can use jstack to take dump for that particular process.
jstack process_id >> tomcat_dump.log
Upvotes: 1