阿里的arthas 连接java进程问题

java程序明明启动着呢, 为什么连接不到, 检测方法运行时间也不行, 在内存中找不到该类, 报以下错误

[arthas@3078]$ trace com.yh.maduoyu.batch.TestAvitor testAvitor
Affect(class count: 0 , method count: 0) cost in 77 ms, listenerId: 1
No class or method is affected, try:
1. sm CLASS_NAME METHOD_NAME to make sure the method you are tracing actually exists (it might be in your parent class).
2. reset CLASS_NAME and try again, your method body might be too large.
3. check arthas log: /root/logs/arthas/arthas.log
4. visit https://github.com/alibaba/arthas/issues/47 for more details.

 

可以根据arthas官网的提示查看

https://github.com/alibaba/arthas/issues/47

  1. 先用sc或者sm搜索对应的类和方法,确认已经被JVM加载
  2. $HOME/logs/arthas/arthas.log中查找有没有Method code too large的异常
  3. 存在该异常时,尝试用reset class_name命令对类进行恢复,再进行trace,watch等操作
  4. 查找内部类要用 $ 符号拼出正确的类名,比如sc outer-class$inner-class
  5. 系统级别的类(即java.*)默认不能进行增强,需要增强是请参考这里的unsafe开关,增强系统类时请谨慎操作
  6. 连错了进程,如果之前连过别的进程,且没有shutdown退出,则下次连别的进程时,默认还会连到之前连的进程上。
  7. 由Arthas自身的ClassLoader加载的类不能被增强

您好,我是问答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题。

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~