By Laurent Goldsztejn on Feb 05, 2013
In my latest blog post I talked about VisualVM, a very effective monitoring and troubleshooting tool. Many other easy-to-use and free tools can be used while working with Java SE. First of all, and since there is no need to re-invent the wheel, you can access documentation of such tools for Windows at Quick Troubleshooting Tips on Windows for Java SE 6 and for Solaris and Linux at Troubleshooting Tools on Solaris OS and Linux for Java SE 6
These tools include jstack, jinfo, jconsole, jmap, jstat, jhat and a few others.
jstack can be use to dump the java threads. While working with WebLogic Server, you can dump the java threads with various tools such as WLST. jstack can do just that but differs from <ctrl>+<break> or kill -3 since it doesn't dump a heap summary along with the threads.
In addition, jstack can print lock information with -l option and the list of synchronizers that may be exclusively owned by a thread. Such information can be very useful while monitoring concurrent access by threads.
jstack comes as part of the JDK installed with WebLogic Server. With instances of WLS running, you can open a new shell, execute the setDomain script and run jstack or any tool that's part of the JDK package. Thread dumps taken by jstack can be redirected to files, e.g. jstack <pid> > myTD.txt.
PIDs can be obtained on Solaris/Linux with the ps (report process status) command, e.g. ps -ef | grep java, and from the task managed on Windows. In task manager you might need to go to View and Select Columns to add PID or process identifiers.