1. 程式人生 > >openjdk1.8執行jmap報錯

openjdk1.8執行jmap報錯

openjdk版本

openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

執行jmap -heap 報錯

 jmap -heap  17694  
Attaching to process ID 17694, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.161
-b14 using parallel threads in the new generation. using thread-local object allocation. Concurrent Mark-Sweep GC Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 8589934592 (8192.0MB) NewSize = 1570308096 (1497.5625MB) MaxNewSize = 1570308096
(1497.5625MB) OldSize = 7019626496 (6694.4375MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 21807104 (20.796875MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 0
(0.0MB) Heap Usage: Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.tools.jmap.JMap.runTool(JMap.java:201) at sun.tools.jmap.JMap.main(JMap.java:130) Caused by: java.lang.RuntimeException: unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:144) at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260) at sun.jvm.hotspot.tools.Tool.start(Tool.java:223) at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:49) ... 6 more

原因是機器缺少openjdk-debuginfo這個包 ,注意該包版本必須和jdk版本一致。

或者從下面網站找

http://debuginfo.centos.org/6/x86_64/ 

將rpm包下載到伺服器本地,手動安裝

rpm -ivh java-1.8.0-openjdk-debuginfo-1.8.0.161-3.b14.el6_9.x86_64.rpm