Solved

How to generate Java Heap Dump?

Posted on 2009-07-07
7
5,160 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 46
splitOdd10 challenge 5 81
JDeveloper 12c for 32 bit 4 71
fibonacci ten numbers 4 30
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now