-
Hello 👋 I'm very curious on how otel is able to hook into I'm using bytebuddy to create an agent but for some reason the binconsumer that is supplied in java.lang.NoClassDefFoundError .
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You need to ensure that the class you instrument (in this case |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the answer |
Beta Was this translation helpful? Give feedback.
You need to ensure that the class you instrument (in this case
jdk.internal.net.http.HttpClientImpl
) has access to the class that you use in your advice (lets call itResponseConsumer
). The first hurdle is that the javaagent is loaded with app class loader (system class loader in jdk8) andHttpClientImpl
is loaded with platform class loader (it is not present in jdk8, but on jdk8 jdk classes are loaded by boot loader). Platform loader is parent of app loader soHttpClientImpl
won't have access to classes in agent jar. The way you get around this is adding your agent to boot loader withInstrumentation.appendToBootstrapClassLoaderSearch
. Typically you'd do this as the verify first thing in…