java
Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 24-09-2010, 07:53
rjshuttleworth rjshuttleworth is offline
Junior Member
 
Join Date: Sep 2010
Posts: 11
Default Jmap Heap Dumps and JDK versions

Anyone experienced an issue attaching to a VM to do a heap dump? I am getting an incorrect version reported. Here's a jmap output:

Code:
[root@domU-12-31-39-0E-AE-12 ~]# jmap 27624
Attaching to process ID 27624, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at sun.tools.jmap.JMap.runTool(JMap.java:196)
    at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 1.6.0-b09. Target VM is 10.0-b19
    at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:217)
    at sun.jvm.hotspot.runtime.VM.<init>(VM.java:280)
    at sun.jvm.hotspot.runtime.VM.initialize(VM.java:333)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:594)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:494)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:332)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
    at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:39)
    ... 6 more
and here's my java version:

Code:
[root@domU-12-31-39-0E-AE-12 ~]# java -version
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)
[root@domU-12-31-39-0E-AE-12 ~]#
Seems to me that running in server mode reports back to jmap the wrong version number.

I am running jmap from the bin directory of the VM that is running my service (tcserver) and it's definitely java 1.6!

Any ideas?

Ryan
Reply With Quote
  #2  
Old 13-12-2010, 11:26
Barry Barry is offline
Moderator
 
Join Date: Jul 2008
Posts: 106
Default

Hi Ryan,

Sorry for the late reply. I've had this issue before, Jmap and other JVM utilities are extremely version sensitive.
Have you tried executing the command as: ./jmap <pid> (from the bin folder of the running JVM)

By not including the ./ the system will still default to the $PATH and $CLASSPATH and not the current folder, which could be the other JVM install.

Your best bet is to only have one install, but that's not always possible
Reply With Quote
  #3  
Old 31-01-2013, 10:15
ashishkanchan ashishkanchan is offline
Junior Member
 
Join Date: Jan 2013
Posts: 2
Default jmap is giving the JVM version mismatch

Anyone experienced an issue attaching to a VM to do a heap dump? I am getting an incorrect version reported. Here's a jmap output:

jmap -dump:format=b,file=/var/neoMemDump/dump.bin 12550
12550: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
[root@MyTimes237 bin]# jmap -F -dump:format=b,file=/var/neoMemDump/dump.bin 12550
Attaching to process ID 12550, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.tools.jmap.JMap.runTool(JMap.java:196)
at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException : Supported versions are 14.0-b16. Target VM is 20.5-b03
at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java: 223)
at sun.jvm.hotspot.runtime.VM.<init>(VM.java:286)
at sun.jvm.hotspot.runtime.VM.initialize(VM.java:344)
at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSp otAgent.java:594)
at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAge nt.java:494)
at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpo tAgent.java:332)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.j ava:77)
... 6 more



My Java Version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)


please anyone let me know, how can i take heap dump
Reply With Quote
  #4  
Old 31-01-2013, 10:49
kjkoster kjkoster is offline
Forum Operator
 
Join Date: Jul 2008
Posts: 1,126
Default

Dear ashishkanchan,

You need to use the jmap that comes with the JVM. From your error message I gather that you are using a different version of jmap than of the JVM.

Please check what JVMs are installed on your machine and ensure than when you run jmap, you use the right version.

To solve such issues I never rely on path. Instead I set JAVA_HOME to be the one that the JVM uses and then invoke both the JVM and jmap like so:

Code:
$ JAVA_HOME=/usr/local/jdk1.6.0
$ export JAVA_HOME
$ ${JAVA_HOME}/bin/java ...

...

$ $(JAVA_HOME}/bin/jmap ...
Hope this helps.

Kees Jan
Reply With Quote
  #5  
Old 31-01-2013, 11:12
ashishkanchan ashishkanchan is offline
Junior Member
 
Join Date: Jan 2013
Posts: 2
Default

Thanks Boss
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump