[root@cdp-node12 /usr/lib/java-1.8.0]# jstack 21439
21439: 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@cdp-node12 /usr/lib/java-1.8.0]# jstack -F 21439
Attaching to process ID 21439, please wait...
Error attaching to process: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.352-b1. Target VM is 25.232-b09
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.352-b1. Target VM is 25.232-b09
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.JStack.main(JStack.java:92)
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.jstack.JStack.runJStackTool(JStack.java:146)
at sun.tools.jstack.JStack.main(JStack.java:111)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.352-b1. Target VM is 25.232-b09
at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:227)
at sun.jvm.hotspot.runtime.VM.<init>(VM.java:294)
at sun.jvm.hotspot.runtime.VM.initialize(VM.java:370)
at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:431)
... 11 more
在服务器上jstack pid的时候突然不行了。具体报错如下,看着好像是版本不对。
Supported versions are 25.352-b1. Target VM is 25.232-b09
回想下 这台服务器好像jdk版本换过几次,可能有问题,那怎么解决呢?
先看当前版本
怎么找到以前的这个版本呢? 找bin/下的java文件通过试java -version 来看当前运行的程序是执行的哪个 java。
sudo find / -name 'java'|grep bin
找到java目录 /usr/java/jdk1.8.0_232-cloudera/bin/java
所以再执行/usr/java/jdk1.8.0_232-cloudera/bin/jstack 21439 >jstack.txt 失败
加了-F 成功 /usr/java/jdk1.8.0_232-cloudera/bin/jstack -F 21439 >jstack.txt