Skip to content

Instantly share code, notes, and snippets.

@cowboy-cod3r
Created December 7, 2013 03:19
Show Gist options
  • Save cowboy-cod3r/7836858 to your computer and use it in GitHub Desktop.
Save cowboy-cod3r/7836858 to your computer and use it in GitHub Desktop.
Java: Steps for JVisualVM
1. On the tomcat server, do the following:
a. Open the firefwall to allow connections over the jmx port
b. Make the following directories
mkdir -p /home/tomcat/.jvisualvm/7u6
chown -R tomcat:tomcat /home/tomcat
c. Add the following java options to tomcat in setenv.sh
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9004
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
d. Restart tomcat
e. In order to get a memory and heap dump properly, you should start JVisualVM as the user that started the JVM process you will attached to. In this case 'tomcat'.
xhost +
cd /opt/apps/java/java/bin
su -c "./jvisualvm"
f. You should now be able to capture a heap dump from one of the tabs in the form of an hprof file which can be used with MAT in eclipse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment