Giter VIP home page Giter VIP logo

javaagent-demo's People

Contributors

yulewei avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lqnasa

javaagent-demo's Issues

请问如何测试TimingInterceptor?

请问如何测试agentmain模式下的TimerAgent,能否私信给个微信请教一下?
我修改了一下TimerAgent,添加了agentmain,结果测试的时候报错:

Exception in thread "Attach Listener" java.lang.NoSuchMethodException: com.demo.TimerAgent.agentmain(java.lang.String, java.lang.instrument.Instrumentation)
at java.lang.Class.getDeclaredMethod(Class.java:2130)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:327)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
Agent failed to start!
Exception in thread "main" java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@17a7cec2
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:384)
at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:233)
at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:208)
at com.demo.AgentLoader2.main(AgentLoader2.java:30)
Caused by: 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 net.bytebuddy.agent.Attacher.install(Attacher.java:88)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:379)
... 3 more
Caused by: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:121)
... 9 more

agentmain 方式测试错误?感觉是main

依次运行 gradle runDemo2 和 gradle runAgentLoaderBuddy,运行gradle runAgentLoaderBuddy时报错:

Exception in thread "main" java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@4eec7777
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:384)
at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:233)
at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:208)
at com.demo.AgentLoader2.main(AgentLoader2.java:29)
Caused by: 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 net.bytebuddy.agent.Attacher.install(Attacher.java:88)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:379)
... 3 more
Caused by: com.sun.tools.attach.AgentLoadException: Agent JAR not found or no Agent-Class attribute
at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:117)
... 9 more
Error opening zip file or JAR manifest missing: E:\Temp\javaagent-demo\proj-byte-buddy\target\libs\proj-byte-buddy.jar

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':proj-demo:runAgentLoaderBuddy'.

Process 'command 'C:\Program Files\Java\jdk1.8.0_211\bin\java.exe'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
8 actionable tasks: 1 executed, 7 up-to-date

请问能否加你微信或者QQ请教(方便的话站内短信M我),我对ByteBuddy的文档不是很理解?谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.