欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【Java】jstack报错Unable to open socket file: target process not responding or HotSpot VM not loaded

程序员文章站 2022-03-15 13:10:00
...

1.美图

【Java】jstack报错Unable to open socket file: target process not responding or HotSpot VM not loaded

2.背景

[aaa@qq.com /]# jstack -l 3859  >> aa.txt
bash: jstack: command not found
[aaa@qq.com /]#

[aaa@qq.com /]# cat  ~/.bash_profile
PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/jdk64/jdk1.8.0_112/bin/
export PATH

[aaa@qq.com /]# source bash_profile

[aaa@qq.com /]# /usr/jdk64/jdk1.8.0_112/bin/jstack  -l 3859 >> a.txt
3859: 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
[aaa@qq.com /]#

报错是因为 当前pid非当前用户所创建
可以执行这个命令

su - $( ps -ef|grep 3859|grep -v grep|awk '{print $1}') -c "/usr/jdk64/jdk1.8.0_112/bin/jstack -l 3859"