今天利用jmap命令时候发现报错信息如下:

[root@*****]# jmap -heap 28837
Attaching to process ID 28837, 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:606)
    at sun.tools.jmap.JMap.runTool(JMap.java:197)
    at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 24.65-b04. Target VM is 25.172-b11
    at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:234)
    at sun.jvm.hotspot.runtime.VM.<init>(VM.java:297)
    at sun.jvm.hotspot.runtime.VM.initialize(VM.java:368)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:598)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:493)
    at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:331)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
    at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:40)

 

排查原因是由于机器上安装了多个jdk导致的。所以使用时要指定路径  :/usr/java/jdk1.8.0_172-amd64/bin/jmap


[root@*****]# /usr/java/jdk1.8.0_172-amd64/bin/jmap -heap 28837
Attaching to process ID 28837, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.172-b11

using thread-local object allocation.
Parallel GC with 4 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 1073741824 (1024.0MB)
   NewSize                  = 22020096 (21.0MB)
   MaxNewSize               = 357564416 (341.0MB)
   OldSize                  = 45088768 (43.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 315621376 (301.0MB)
   used     = 210797952 (201.0325927734375MB)
   free     = 104823424 (99.9674072265625MB)
   66.78823680180648% used
From Space:
   capacity = 18874368 (18.0MB)
   used     = 11308096 (10.78424072265625MB)
   free     = 7566272 (7.21575927734375MB)
   59.912448459201386% used
To Space:
   capacity = 18874368 (18.0MB)
   used     = 0 (0.0MB)
   free     = 18874368 (18.0MB)
   0.0% used
PS Old Generation
   capacity = 75497472 (72.0MB)
   used     = 42803688 (40.820777893066406MB)
   free     = 32693784 (31.179222106933594MB)
   56.69552485148112% used

 

转载于:https://www.cnblogs.com/xugh/p/9672842.html

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐