使用JMAP获取heapdump时出现异常

时间:2013-11-20 23:40:18

标签: java exception jmap

当我使用

获取heapdump时,我得到以下异常

jmap -F -dump:format = b,file = / tmp / heapdump / before.hprof 10737

Attaching to process ID 10737, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.tools.jmap.JMap.runTool(JMap.java:179)
    at sun.tools.jmap.JMap.main(JMap.java:110)
Caused by: java.lang.RuntimeException: Type "nmethodBucket*", referenced in VMStructs::localHotSpotVMStructs in the remote VM, was not present in the remote VMStructs::localHotSpotVMTypes table (should have been caught in the debug build of that VM). Can not continue.
    at sun.jvm.hotspot.HotSpotTypeDataBase.lookupOrFail(HotSpotTypeDataBase.java:361)
    at sun.jvm.hotspot.HotSpotTypeDataBase.readVMStructs(HotSpotTypeDataBase.java:252)
    at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:87)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:568)
    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.HeapDumper.main(HeapDumper.java:77)

任何人都知道如何解决这个问题?

2 个答案:

答案 0 :(得分:29)

我看到同样的错误,因为我的jmap路径与java进程的路径不同(即定位两个不同的版本)。

使用JDK的完整路径运行jmap解决了它。

答案 1 :(得分:0)

如果使用OpenJDK,则需要安装debuginfo-packages。

在Centos中,这适用于   - sudo yum install java-1.8.0-openjdk-debuginfo.x86_64   - 或cross apply()

请参阅   - https://bugzilla.redhat.com/show_bug.cgi?id=1010786#c15   - amazon linux - install openjdk-debuginfo?