Closed kavehshahedi closed 2 months ago
This does not quite make sense to me. Could you investigate how the methods get instrumented? Register an AgentBuilder.Listener, possibly some of the instrumentations are failing
Thanks for the suggestion. After attaching a listener to the agent, this error popped up:
Cannot write invoke dynamic instruction for class file version Java 6 (50)
As I investigated the previous issues, it turned out that the lambda dynamic invocation was causing the problem. I re-compiled the agent with Java 7, and the problem seems to be fixed.
Thanks again!
Hello,
As shown in the following code, I have created an agent in order to instrument the methods of a project with a specific class name and capture their execution times:
The agent works in most cases, but in some projects, it throws
java.lang.NoSuchMethodError
error during the execution. For instance, the following error comes from this line of the codereturn callable.call();
:Based on one of the suggestions in this this issue, I formatted the code in way that it uses Advice instead of MethodDelegation, as follows:
These modifications fix the error, but the other problem is that the agent is not able to instrument all the classes and subclasses under the target package name. For instance, the agent attaches to a jar, which is a JMH benchmark that is benchmarking a baseline project (both of them have the same package names). The agent instruments the methods within the jmh project correctly (i.e., methods that are targeting the baseline project), but it can't capture the methods from the baseline project. However, when using
MethodDelegation
instead ofAdvice
, the agent instruments all the methods (but as said, it throws the mentioned error).I would be glad if you could inform me how to overcome this issue. Thanks!