You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "M. Manna" <ma...@gmail.com> on 2017/10/04 14:08:53 UTC

Force ParallelWebappClassLoader to load instrumentation agent after VM starts

Hi,

I was hoping to get some help/suggestion since I have nearly exhausted all
options (at least, I have tried quite a few items).

I have an instrumentation agent which i want to load after the VM starts
tomcat. I have no problem loading the agent itself.

What I am having issues with is the classloader that loads the agent. By
Default System class loader loads any agent as per Instrumentation docs.
But I suppose there might be a trick which can use the same classloader as
the web application e.g. using ParallelWebappClassLoader.

If I do Class.forName() check before the agent is injected
ParallelWebappClassLoader loads my agent class. But as soon as the VM
invokes the agent, I can no longer have the same loader. System class
loader takes over.

Could anyone share any experience in this area so that I can load my agent
with one of Tomcat's app classloaders?

Kindest Regards,