Creating a Java heapdump in JBoss AS 6.x

Submitted by Jochus on Wed, 12/12/2012 - 23:12 | Posted in: Java


If you want to create a heapdump from your application running in a JBoss AS 6.X J2EE container, you can easily perform the dump operation by some MBean in the JMX console.

  • Browse to: http://localhost:8080/jmx-console/
  • Search for com.sun.management and click on type=HotSpotDiagnostic
  • Scroll to the bottom of the page and provide the parameter /tmp/heap.dump in the textfield p0, which is actually the location to which the dump will be written. If you want to perform a garbage collection before dumping, leave p1 on value true
  • Push the button Invoke. A dump file will be available at /tmp/heap.dump. This file can easily be viewed by a tool like Java VisualVM



Also, remember that you can easily create a heap dump automatically when JBoss is going OutOfMemory. Just add the following Java arguments in your run.conf file

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heap.dump

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.