How to share some data between agent and app with bytebuddy #1672
-
Hi, I am working on a project to intercept class I create a class
Then I intercept
I realized this will not work as I tried May I know whether there is any possible way I can pass the data from client to agent and used by interceptor of Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I found there is a way to write the data in a text file and read it in interceptor which is pretty hacky. Hope there will be a better solution. |
Beta Was this translation helpful? Give feedback.
-
Ideally, you create a different jar and add it as a resource to your agent jar. Upon startup of the agent, you extract the jar to a temporary location and then attach the jar to the boot loader. This way, you avoid that it gets loaded twice! |
Beta Was this translation helpful? Give feedback.
-
Thanks @raphw for the quick response! You suggestion works perfectly for me! Also I realized I had the test app in the same build environment as the agent so some classes will be loaded by app class loader. Now I separate the test app code in another repo and force loading the classes from bootstrap using Java reflection (e.g. |
Beta Was this translation helpful? Give feedback.
Ideally, you create a different jar and add it as a resource to your agent jar. Upon startup of the agent, you extract the jar to a temporary location and then attach the jar to the boot loader. This way, you avoid that it gets loaded twice!