[alibaba/arthas]arthas和skywalking8.9.1的fastjson插件冲突,(127.0.0.1 3658 Connection refused)

2024-04-24 685 views
4
环境信息
  • arthas-boot.jar 或者 as.sh 的版本: 3.5.5
  • Arthas 版本: 3.5.5
  • 操作系统版本: CentOS7-Docker-Tini
  • 目标进程的JVM版本: jdk1.8.0_311
  • 执行arthas-boot的版本: 3.5.5
重现问题的步骤
  1. 服务端:运行skywalking8.9.1
  2. 客户端:将agent/optional-plugins/apm-fastjson-1.x-plugin-8.8.0.jar 移动到 agent/plugins/
  3. 启动应用,启动arthas
期望的结果

[INFO] Try to attach process 6 [INFO] Attach process 6 success. [INFO] arthas-client connect 127.0.0.1 3658

实际运行的结果
 [1]: 6 pigx-oa-platform.jar
[INFO] arthas home: /app/.arthas/lib/3.5.5/arthas
[INFO] Try to attach process 6
[INFO] Attach process 6 success.
[INFO] arthas-client connect 127.0.0.1 3658
Connect to telnet server error: 127.0.0.1 3658
java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
        at java.net.Socket.connect(Socket.java:606)
        at org.apache.commons.net.SocketClient.connect(SocketClient.java:188)
        at org.apache.commons.net.SocketClient.connect(SocketClient.java:209)
        at com.taobao.arthas.client.TelnetConsole.process(TelnetConsole.java:306)
        at com.taobao.arthas.client.TelnetConsole.main(TelnetConsole.java:166)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.taobao.arthas.boot.Bootstrap.main(Bootstrap.java:615)
把异常信息贴到这里

回答

2

检查 ~/logs/arthas/arthas.log

7
Arthas server agent start...
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.taobao.arthas.agent334.AgentBootstrap.bind(AgentBootstrap.java:182)
        at com.taobao.arthas.agent334.AgentBootstrap.access$000(AgentBootstrap.java:20)
        at com.taobao.arthas.agent334.AgentBootstrap$1.run(AgentBootstrap.java:152)
Caused by: java.lang.ExceptionInInitializerError
        at com.taobao.arthas.core.server.ArthasBootstrap.initFastjson(ArthasBootstrap.java:181)
        at com.taobao.arthas.core.server.ArthasBootstrap.<init>(ArthasBootstrap.java:133)
        at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:579)
        at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:567)
        ... 7 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.alibaba.fastjson.JSON.<clinit>(JSON.java:1248)
        ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139)
        ... 15 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/skywalking/apm/agent/core/plugin/interceptor/enhance/StaticMethodsInter;
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
        at java.lang.Class.getDeclaredField(Class.java:2068)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$ForStaticField.onLoad(LoadedTypeInitializer.java:163)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655)
        ... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsInter
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at com.taobao.arthas.agent.ArthasClassloader.loadClass(ArthasClassloader.java:34)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 25 more
5

i got the same problem: skywalking:8.9.1 jdk:11.0.9 arthas:3.5.5

the ~/logs/arthas/arthas.log is : Arthas server agent start... java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.taobao.arthas.agent334.AgentBootstrap.bind(AgentBootstrap.java:182) at com.taobao.arthas.agent334.AgentBootstrap.access$000(AgentBootstrap.java:20) at com.taobao.arthas.agent334.AgentBootstrap$1.run(AgentBootstrap.java:152) Caused by: java.lang.ExceptionInInitializerError at com.taobao.arthas.core.server.ArthasBootstrap.initFastjson(ArthasBootstrap.java:181) at com.taobao.arthas.core.server.ArthasBootstrap.(ArthasBootstrap.java:133) at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:579) at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:567) ... 7 more Caused by: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.alibaba.fastjson.JSON.(JSON.java:1248) ... 11 more Caused by: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedMethodAccessor58.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ... 15 more Caused by: java.lang.NoClassDefFoundError: Lorg/apache/skywalking/apm/agent/core/plugin/interceptor/enhance/StaticMethodsInter; at java.base/java.lang.Class.getDeclaredFields0(Native Method) at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3062) at java.base/java.lang.Class.getDeclaredField(Class.java:2410) at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$ForStaticField.onLoad(LoadedTypeInitializer.java:163) at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ... 19 more Caused by: java.lang.ClassNotFoundException: org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsInter at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) at com.taobao.arthas.agent.ArthasClassloader.loadClass(ArthasClassloader.java:34) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 25 more Arthas server agent start... java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.taobao.arthas.agent334.AgentBootstrap.bind(AgentBootstrap.java:182) at com.taobao.arthas.agent334.AgentBootstrap.access$000(AgentBootstrap.java:20) at com.taobao.arthas.agent334.AgentBootstrap$1.run(AgentBootstrap.java:152) Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.fastjson.JSON at com.taobao.arthas.core.server.ArthasBootstrap.initFastjson(ArthasBootstrap.java:181) at com.taobao.arthas.core.server.ArthasBootstrap.(ArthasBootstrap.java:133) at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:579) at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:567) ... 7 more