arthas 不支持 tomcat

Created on 26 Dec 2019  ·  4Comments  ·  Source: alibaba/arthas

  • [ ] 我已经在 issues 里搜索,没有重复的issue。

环境信息

  • arthas-boot.jar 或者 as.sh 的版本: 3.1.7
  • Arthas 版本:3 .1.7
  • 操作系统版本: centos 7.4
  • 目标进程的JVM版本:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
  • 执行arthas-boot的版本: :3 .1.7

重现问题的步骤

  1. java -jar arthas-boot.jar

期望的结果

使用root账号运行arthas, tomcat 使用tomcat (tomcat:x:1001:1001::/opt/tomcat:/bin/nologin
)账号运行

实际运行的结果

[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.(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:85)
at com.taobao.arthas.core.Arthas.(Arthas.java:28)
at com.taobao.arthas.core.Arthas.main(Arthas.java:123)
[ERROR] attach fail, targetPid: 28821

```
把异常信息贴到这里

java -jar arthas-boot.jar

[INFO] arthas-boot version: 3.1.7
[INFO] Found existing java process, please choose one and hit RETURN.

  • [1]: 28821 org.apache.catalina.startup.Bootstrap
    1
    [INFO] arthas home: /root/.arthas/lib/3.1.7/arthas
    [INFO] Try to attach process 28821
    [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.(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:85)
    at com.taobao.arthas.core.Arthas.(Arthas.java:28)
    at com.taobao.arthas.core.Arthas.main(Arthas.java:123)
    [ERROR] attach fail, targetPid: 28821
question-answered

Most helpful comment

感谢:解决
cd /tmp && curl -O https://alibaba.github.io/arthas/arthas-boot.jar
ps aux | grep tomcat 找到PID
sudo -u tomcat -s /bin/bash -c 'java -jar /tmp/arthas-boot.jar PID'

All 4 comments

切换到同一个用户名,再操作。

试过了,不行,因为 tomcat 的用户设置为/bin/nologin

感谢:解决
cd /tmp && curl -O https://alibaba.github.io/arthas/arthas-boot.jar
ps aux | grep tomcat 找到PID
sudo -u tomcat -s /bin/bash -c 'java -jar /tmp/arthas-boot.jar PID'

Was this page helpful?
0 / 5 - 0 ratings