首先使用ps -ef查询java进程号:
linux-h4j5:/opt/aiservice/jdk/bin # ps -ef | grep java
root 25037 24942 0 18:55 pts/1 00:00:00 grep java
ai 26216 1 0 Mar27 ? 01:47:40 /opt/aiservice/jdk/bin/java -cp . org.springfr amework.boot.loader.WarLauncher
You have new mail in /var/mail/root
在使用jstack提示以下错误:
linux-h4j5:/opt/aiservice/jdk/bin # ./jstack 26216
26216: 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
原因:26216的所属用户不是root。
解决方法:切换到26216所属的用户,再执行jstack命令