qunarcorp / bistoury

Bistoury是去哪儿网的java应用生产问题诊断工具,提供了一站式的问题诊断方案
GNU General Public License v3.0
4.04k stars 830 forks source link

Agent JAR loaded but agent failed to initialize #145

Open cy503328434 opened 2 years ago

cy503328434 commented 2 years ago

一点文件信息的时候就报:Agent JAR loaded but agent failed to initialize

agent的jvm启动参数 :

-Dbistoury.local.host=192.168.91.1 -Dbistoury.proxy.host=192.168.91.128:9090 -Dbistoury.user.pid=18208 -Xbootclasspath/a:D:\JAVA\JDK\lib\tools.jar -Dbistoury.app.lib.class=org.springframework.web.servlet.DispatcherServlet -XX:-OmitStackTraceInFastThrow -Dbistoury.app.lib.class=org.springframework.web.servlet.DispatcherServlet -Dbistoury.agent.jar.path=F:\jvm\bistoury\bistoury-instrument-agent.jar -Dbistoury.arthas.core.jar.path=F:\jvm\arthas\arthas-core-3.1.4.jar

我自己应用的报错:

Exception in thread "Attach Listener" 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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
    at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: illegal jar files, []
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.main(AgentBootstrap2.java:280)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.agentmain(AgentBootstrap2.java:90)
    ... 6 more
Caused by: java.lang.IllegalStateException: illegal jar files, []
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.getJarFile(AgentBootstrap2.java:293)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.main(AgentBootstrap2.java:247)
    ... 7 more
Agent failed to start!

agent的报错:

com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
    at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:121) ~[na:na]
    at qunar.tc.bistoury.commands.arthas.ArthasStarter.attachAgent(ArthasStarter.java:99) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasStarter.start(ArthasStarter.java:56) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasEntity.start(ArthasEntity.java:38) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.forceCreateClient(AbstractTelnetStore.java:149) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.createClient(AbstractTelnetStore.java:141) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.doGetTelnet(AbstractTelnetStore.java:108) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.getTelnet(AbstractTelnetStore.java:53) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasTask$Job.init(ArthasTask.java:118) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.ForwardContinueResponseJob.init(ForwardContinueResponseJob.java:23) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$WrappedJob.init(DefaultResponseJobStore.java:293) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$PausedJob.init(DefaultResponseJobStore.java:133) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$JobRunner.run(DefaultResponseJobStore.java:247) [classes/:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_311]
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111) [guava-20.0.jar:na]
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58) [guava-20.0.jar:na]
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75) [guava-20.0.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_311]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_311]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_311]
[17:53:32 [log-agent-exec-2] INFO q.t.b.commands.arthas.ArthasStarter:60] - start attach to arthas agent
[17:53:32 [log-agent-exec-2] INFO q.t.b.commands.arthas.ArthasStarter:95] - start load arthas agent, input F:\jvm\bistoury\bistoury-instrument-agent.jar, load F:\jvm\bistoury\bistoury-instrument-agent.jar
[17:53:32 [log-agent-exec-2] ERRORq.t.b.commands.arthas.ArthasEntity:40] - start arthas error, pid [18208]
com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
    at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:121) ~[na:na]
    at qunar.tc.bistoury.commands.arthas.ArthasStarter.attachAgent(ArthasStarter.java:99) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasStarter.start(ArthasStarter.java:56) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasEntity.start(ArthasEntity.java:38) ~[classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.forceCreateClient(AbstractTelnetStore.java:149) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.doGetTelnet(AbstractTelnetStore.java:110) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.telnet.AbstractTelnetStore.getTelnet(AbstractTelnetStore.java:53) [classes/:na]
    at qunar.tc.bistoury.commands.arthas.ArthasTask$Job.init(ArthasTask.java:118) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.ForwardContinueResponseJob.init(ForwardContinueResponseJob.java:23) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$WrappedJob.init(DefaultResponseJobStore.java:293) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$PausedJob.init(DefaultResponseJobStore.java:133) [classes/:na]
    at qunar.tc.bistoury.agent.common.job.DefaultResponseJobStore$JobRunner.run(DefaultResponseJobStore.java:247) [classes/:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_311]
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111) [guava-20.0.jar:na]
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58) [guava-20.0.jar:na]
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75) [guava-20.0.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_311]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_311]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_311]
[17:53:32 [log-agent-exec-5] ERRORq.t.b.remoting.netty.TaskProcessor:106] - arthas command error, id [220205.175330.192.168.91.128.23931.2544], command [appconfig -pid18208]

用户目录下logs/arthas的日志:

2022-02-05 14:14:43 [arthas-NettyHttpTelnetBootstrap-3-2] INFO  c.t.a.core.shell.term.impl.Helper -Loaded arthas keymap file from com/taobao/arthas/core/shell/term/readline/inputrc
bistoury server agent start...
java.lang.IllegalStateException: illegal jar files, [D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4-sources.jar, D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4-sources.jar.sha1, D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4.jar, D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4.jar.sha1, D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4.pom, D:\develop\maven\repository\com\taobao\arthas\arthas-core\3.1.4\arthas-core-3.1.4.pom.sha1]
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.getJarFile(AgentBootstrap2.java:293)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.main(AgentBootstrap2.java:244)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.agentmain(AgentBootstrap2.java:90)
    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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
    at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
bistoury server agent start...
java.lang.IllegalStateException: illegal jar files, []
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.getJarFile(AgentBootstrap2.java:293)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.main(AgentBootstrap2.java:247)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.agentmain(AgentBootstrap2.java:90)
    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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
    at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
bistoury server agent start...
java.lang.IllegalStateException: illegal jar files, []
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.getJarFile(AgentBootstrap2.java:293)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.main(AgentBootstrap2.java:247)
    at qunar.tc.bistoury.instrument.agent.AgentBootstrap2.agentmain(AgentBootstrap2.java:90)
    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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
    at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)