我在这篇文章中遇到了同样的问题。
https://stackoverflow.com/questions/49321938/instrument-in-java-level-using-byte-buddy/55032131#55032131
当我使用代码工具threadpoolexecutor时,
new AgentBuilder.Default()
.ignore(ElementMatchers.none())
.type(ElementMatchers.nameContains("ThreadPoolExecutor"))
.transform((builder, type, classLoader, module) -> builder
.visit(Advice.to(ThreadPoolExecutorAdvice.class).on(ElementMatchers.any()))
).installOn(instrumentation);
我收到此错误,如何解决?
java.lang.IllegalStateException: Cannot represent public org.apache.tomcat.util.threads.ThreadPoolExecutor(int,int,long,java.util.concurrent.TimeUnit,java.util.concurrent.BlockingQueue,java.util.concurrent.RejectedExecutionHandler) as given method constant
答案 0 :(得分:0)
您可能正在尝试插入Method
时注入Constructor
实例。切换参数类型,它应该可以解决。