Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to generate Java Heap Dump?

Posted on 2009-07-07
7
Medium Priority
?
5,262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

618 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