arthas启动报错

发布时间 2023-11-07 13:45:29作者: 白玉神驹

报错信息

[INFO] Try to attach process 26614
Picked up JAVA_TOOL_OPTIONS:
[ERROR] Start arthas failed, exception stack trace:
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
        at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)
        at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78)
        at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:250)
        at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:102)
        at com.taobao.arthas.core.Arthas.<init>(Arthas.java:27)
        at com.taobao.arthas.core.Arthas.main(Arthas.java:161)
[ERROR] attach fail, targetPid: 26614

原因:Java程序运行用户与arthas运行用户不一致

解决

1. 查看Java程序端口号 jps

2. 查看Java程序运行用户 ps -ef | grep 26614

3. 切换到当前用户su username启动即可