Capture Thread and Heap Dumps using Java Visual JVM

Document ID : KB000100826
Last Modified Date : 11/06/2018
Show Technical Document Details
Introduction:
When troubleshooting an issue with Tomcat, you may be advised by CA Support to gather Thread and Heap dump information for the affected Tomcat process.
Environment:
CA Service Desk Manager - ALL VERSIONS
Instructions:
To capture the thread and heap dump, please follow the instructions below:

1. Enable JMX Remote debugging in SDM’s NX.env   Example:
NX_JAVA_OPTIONS=-Djava.net.preferIPv4Stack=false -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=30001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=HOSTNAME -Xms64M -Xmx512M

NOTE:  replace HOSTNAME with the correct hostname value of the SDM node to which you are making this change to.  This is case sensitive.  You would have to use the same case in Step#7 later in the doc

2. Restart Tomcat  (of course if you need for VIZ or WF, you could do the same for that Tomcat’s Java options in NX.env).    pdm_tomcat_nxd -c stop   (make sure java or java.exe listening on appropriate Tomcat disappears from LISTENING status).  And then kill the PID of pdm_tomcat_nxd process related to the tomcat daemon in question.   OR  Restart SDM.

3. Now you’ll see javaw.exe  also listening on 30001

4. Have JDK 1.6.0.32 or something higher installed, it comes with  jvisualvm

5. From a client machine where JDK is installed, open jvisualvm present in JDK_FOLDER\bin.

6.  Click on File-> 'Add Remote Host' and add the SDM Tomcat server hostname.
User-added image

7. In the Applications Pane -> Remote , right click on remote host added and 'Add JMX connection'.
User-added image

8. Make the connection by giving the port as 9999 and click on OK.

9. Go to the Overview tab and take a screen print 
User-added image

10  Click on the Monitor tab,  get a screen print

11.  On the Monitor tab,  click Heap Dump,  save it to a file. We need this file too  (Note: heap dump goes to the Tomcat server machine itself) 
User-added image

12. Click on the Threads tab, get a screen print

13. Click on the Thread Dump button,  save the output there by selecting everything in the resulting window to a Text file. We need this output.
User-added image 

14. Provide us with the NX_ROOT\log directory zipped based logs for the days in question

15. Provide us with NX_ROOT\bopcfg\www\CATALINA_BASE**\logs   based logs for the days in question.

16. Screen prints of the JVisual VM

17.  Saved Heap Dump file

18. Saved Thread Dump file.