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

1.美图

在这里插入图片描述

2.背景

[root@1 /]# jstack -l 3859  >> aa.txt
bash: jstack: command not found
[root@1 /]#

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

[root@1 /]# source bash_profile

[root@1 /]# /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
[root@1 /]#

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

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

发布了1263 篇原创文章 · 获赞 465 · 访问量 161万+

猜你喜欢

转载自blog.csdn.net/qq_21383435/article/details/105636800