Solved

How to generate Java Heap Dump?

Posted on 2009-07-07
7
5,180 Views
Last Modified: 2013-12-11
Hi,
I want to generate Java Heap Dump to detect Memory Leak. Although I am able to generate Javacore files I could not generate heapdump files. I am using IBM Websphere 6.1 on Windows.

I did following settings:
Navigated to: Servers > Application Servers > Server1 (or the name of
      the server to get a heap dump) > Process Definition > Environment Entries

Then set following properties:
IBM_HEAPDUMP = true
IBM_HEAP_DUMP = true
IBM_JAVA_HEAPDUMP_TEXT=true
IBM_HEAPDUMP_OUTOFMEMORY=false
JAVA_DUMP_OPTS=ONANYSIGNAL(JAVADUMP[5],HEAPDUMP[5])

Then I am running following commands in command prompt:
wsadmin> set jvm [$AdminControl completeObjectName type=JVM,*]
wsadmin> $AdminControl invoke $jvm dumpThreads


Am I missing something?
0
Comment
Question by:cuttieveenz
  • 4
7 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 24801654
This link shoud help you configure what you want ... I hope IBM presents you the page in engish though ... as the german is sometimes rather bad, I would think it automatically translates.

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tprf_enablingheapdump.html
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 24803208
The simple answer is that it depends upon your operating system (OS).

For example

Windows:
  http://www.IBM.com/support/docview.wss?rs=180&uid=swg21384926

Aix & Linux:
  http://www.IBM.com/support/docview.wss?rs=180&uid=swg21297060

Solaris:
  http://www.IBM.com/support/docview.wss?rs=180&uid=swg21321546
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 24803878
It looks like you tried the instructions from

http://www.IBM.com/support/docview.wss?rs=180&uid=swg21384926

After this command:

wsadmin> set jvm [$AdminControl completeObjectName type=JVM,*]

use this one to show the current value of the "jvm" variable:

wsadmin> puts $jvm

What does it show?

Personally, I prefer to use Jython (which is available in a more robust form in v 6.1 and v7.0).
The Jython statements for these commands would be:

1. add "-lang jython" to the command line options used to start wsadmin
    e.g., "wsadmin -lang jython"

2. jvm = AdminControl.completeObjectName( 'type=JVM,*' );
    wsadmin> jvm = AdminControl.completeObjectName( 'type=JVM,*' );

3. print the value of the jvm variable (note the lack of '$' for jython variables):
    wsadmin> print jvm
    WebSphere:name=JVM,process=server1,platform=proxy,node=ragweed01Node,j2eeType=JVM,J2EEServer=server1,version=7.0.0.3,type=JVM,mbeanIdentifier=JVM,cell=ragweed01Cell,spec=1.0

4. call (invoke) the dumpThreads routine

  Then, look for the javacore file.  I found mine under <WAS_HOME>\profiles\<profileName>, specifically:

> dir D:\IBM\WebSphere\AppServer70\profiles\AppSrv00\javacore*.txt

 Directory of D:\IBM\WebSphere\AppServer70\profiles\AppSrv00

07/08/2009  10:00 AM         2,193,629 javacore.20090708.100003.872.0001.txt

0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Accepted Solution

by:
cuttieveenz earned 0 total points
ID: 24811322
We figured out why we couldn't generate Heap dumps. Instead of running the following command:
 
$AdminControl invoke $jvm dumpThreads
 
The following should be run:
$AdminControl invoke $jvm generateHeapDump
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 24812760
Right, the dumpThreads would be used to create a javacore
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 24831041
Sorry I misunderstood the request.

Anything else?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example using maven 12 56
Android development question 2 53
Java: anonymous class 4 29
jsp error 6 25
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question