引入byte-buddy依赖导致Ttl增强失败
guofeiwu opened this issue · 1 comments
guofeiwu commented
// agent 很简单,就是使用了ttlagent,没有其他的
// test-agent.jar
public static void premain(String arguments, Instrumentation instrumentation) throws Exception {
TtlAgent.premain(arguments, instrumentation);
}
// 启动程序,
java -Xbootclasspath/a:/path/transmittable-thread-local-2.11.5.jar -javaagent:/path/test-agent.jar -jar demo.jar
增强成功;
// 项目中引入了以下依赖、想加入其他的功能,导致增强失效,ThreadPoolExecutor 在TtlAgent之前被load
```properties
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.10.7</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.10.7</version>
</dependency>
java -Xbootclasspath/a:/path/transmittable-thread-local-2.11.5.jar -javaagent:/path/test-agent.jar -jar demo.jar
// 尝试把byte-buddy-agent放在test-agent.jar之后,启动
java -Xbootclasspath/a:/path/transmittable-thread-local-2.11.5.jar -javaagent:/path/test-agent.jar -javaagent:/path/byte-buddy-agent.jar -jar demo.jar
增强都失败;
oldratlee commented
resolved by @guofeiwu , see #207 (comment)