Recibo el siguiente error cuando intento usar jmap, jinfo, etc. e intento conectarme a un jvm en ejecución.
Por ejemplo
[x@y bin]$ jmap -heap 3848 Attaching to process ID 3848, please wait... Error attaching to process: java.lang.RuntimeException: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version sun.jvm.hotspot.debugger.DebuggerException: java.lang.RuntimeException: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:435) at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305) at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140) at sun.jvm.hotspot.tools.Tool.start(Tool.java:185) at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:50) 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: can't determine target's VM version : field "_reserve_for_allocation_prefetch" not found in type Abstract_VM_Version at sun.jvm.hotspot.runtime.VM.<init>(VM.java:291) at sun.jvm.hotspot.runtime.VM.initialize(VM.java:370) at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:431) ... 11 more¿Cual podría ser el problema?
El comando jmap que se utiliza puede ser de una versión inferior a la versión jdk utilizada para generar el proceso.
Primero verifique su versión jdk
java -versionLuego, uno puede verificar rápidamente la versión jdk de jvm descifrando el comando de inicio para ese pid.
ps -p {your_jvm_id} -fLa salida debería ser algo como esto.
UID PID PPID C STIME TTY TIME CMD x.y+ 3848 3786 7 Nov18 tty2 20:29:41 /apps/progs/ideaIC-2020.2.3/idea-IC-202.7660.26/jbr/bin/java -classpath /apps/progs/ideaIC-2020.2.3/idea-IC-202.7660.26/lib/bootstrap.jar:/apps/progs/ideaIC-2020.2En la columna CMD, debería ver la ruta del ejecutable Java utilizado para iniciar el proceso. Intente obtener la versión de ese ejecutable.
Por ejemplo:
/apps/progs/ideaIC-2020.2.3/idea-IC-202.7660.26/jbr/bin/java -version openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment JBR-11.0.8.10-944.34-jcef (build 11.0.8+10-b944.34) OpenJDK 64-Bit Server VM JBR-11.0.8.10-944.34-jcef (build 11.0.8+10-b944.34, mixed mode)Note la diferencia entre las versiones.