GlassFish 4 and JVM Agent Classloader Visibility
I have a web-application (WAR) application that makes use of a JVM agent (my implementation). While porting the web-application to GlassFish 4 I bumped into a problem with the web-application not seeing the JVM agent classes on its classpath. When starting the web-application I keep getting a ClassNotFoundException for a class that is bundled in the JVM agent.
In the logs I can see the JVM agent being successfully initialized so no problem here.
This is the classloader hierarchy as logged by my JVM agent. You can see that the JVM agent is loaded by a classloader that also loads the glassfish.jar. I need this classloader to be available in the web-application classloader chain.
[2013-07-17 12:05:38,385] I [main] [MyAgent] - Agent class-loader info:
file:/D:/var/my-agent.jar !!! THIS IS MY AGENT JAR !!!
sun.misc.Launcher$ExtClassLoader@4eb55c7f (parent classloader of the above classloader)
I searched in the GlassFish Admin Console for applicable classloading settings, but did not find anything.
BTW: This problem does not occur on Tomcat, nor on IBM WebSphere where web-applications can normally see classes in the entire classloader hierarchy up to the JVM bootstrap classloader.
Thanks for any hints,