HowTo – Tomcat Wiki

How do I obtain a thread dump of my running webapp ?

You can only get a thread dump of the entire JVM, not just your webapp. This shouldn’t be a big deal, but should be made clear: you are getting a dump of all JVM threads, not just those “for your application”, whatever that means.

Getting a thread dump depends a lot on your environment. Please choose the section below that matches your environment best. The more universal and convenient options are presented first, while the more difficult ones or those for specific setups are provided later. Generally, you should start at the top of the list and work your way down until you find a technique that works for you.

If you are running Sun JDK 1.6 or higher

Sun’s JDK (not the JRE) ships with a program called jstack (or jstack.exe on Microsoft Windows) which will give you a thread dump on standard output. Pipe the output into a file and you have your thread dump. You will need the process id (“pid”) of the process to dump. Use of the program jps (jps.exe on Microsoft Windows) can help you determine the pid of a specific Java process.

If you are on *NIX running Sun JDK

Sun provides jstack on *nix systems from version 1.4 onward. See the above tip if you have such an environnment.

If you are running on *NIX

Send a SIGQUIT to the process. The thread dump will be sent to stdout which is likely to be redirected to CATALINA_BASE/logs/catalina.out.

To send a SIGQUIT, use kill -3 <pid> from the command line.

If you are running Tomcat as a service on Microsoft Windows

Edit your service to add the “//MS//” option to the command line. This enabled the “Monitor Service” which puts an icon in the system tray while Tomcat is running. Right-clicking the Tomcat monitor in the system tray allows you to produce a thread dump in stdout.

If you have Tomcat running in a console

*NIX: Press CRTL- Microsoft Windows: press CRTL-BREAK

This will produce a thread dump on standard output, but may not be possible to capture to a file.

How do I use Hibernate and database connection pooling with Tomcat?

See TomcatHibernate

How do I set up Tomcat virtual hosts in a development environment?

See TomcatDevelopmentVirtualHosts

via HowTo – Tomcat Wiki.