Search code examples
javavisualvm

VisualVM - Cannot take heap dump


When I click on the Heap Dump button in VisualVM 1.3.8, I get the following error:

Cannot take heap dump for user@localhost:9090

Am I missing a setting somewhere?

Edit #1

Environment is:

  • RHEL6
  • Tomcat 7.0.68
  • Java 1.7.0_45

Options are:

export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true\
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=true \
-Djava.rmi.server.hostname=x.x.x.x \
-Dcom.sun.management.jmxremote.password.file=/file_to_pwd \
-Dcom.sun.management.jmxremote.access.file=/file_to_access \
-Xms1256m \
-Xmx1256m \
-XX:PermSize=768m \
-XX:MaxPermSize=768m \
-XX:+CMSClassUnloadingEnabled \
-Dfile.encoding=UTF-8 \
-XX:+CMSClassUnloadingEnabled \
-XX:+UseConcMarkSweepGC \
-server"

Edit #2

Here is the listener for JMX.

<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="9090" rmiServerPortPlatform="9091" />

Solution

  • Here's what I ended up doing. We had JDK 1.8 also present on the server.

    cd /path/to/java/jdk1.8.0_65/
    ./jmap -dump:format=b,file=/path/to/dump/tomcat_dump.bin PID
    

    Open /path/to/dump/tomcat_dump.bin using VisualVM (I had to use Filezilla to bring it to my workstation).