Isolation with shared libraries instances?
jguyard Jan 14, 2009 10:15 AMHi all,
this is my first time posting here.
First of all, I've read almost everything here: http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/beta422/html-single/index.html#Inside_the_JBoss_Class_Loading_Architecture-The_core_JBoss_class_loading_components
I'm working with JBOSS 4.2.3 and my current mission is to deploy the same ear twice in the same jboss server instance.
I had isolation problems (ClassCastException,...), so I decided to start with something very easy and write this TestCase:
I have a ear containing a servlet. This servlet, when requested, prints the fully qualified name of a singleton and his memory address. So here is what I have (TestCase2.ear is a duplication of TestCase1.ear with a different context-root for requesting them seperatly):
server | --- deploy | | | --- ear-deployer.xml (isolated parameter setted to true) | | | --- TestCase1.ear | | | | | --- TestCase1.war | | | | | --- WEB-INF | | | | | --- classes | | | | | | | --- myServlet.class | | | | | --- lib | | | | | --- mySingleton.jar | --- TestCase2.ear | | | | | --- TestCase2.war | | | | | --- WEB-INF | | | | | --- classes | | | | | | | --- myServlet.class | | | | | --- lib | | | | | --- mySingleton.jar
RESULT: The servlets print the same fully qualifiedName but different memory addresses. Until now everything is how I expected.
______________________________________________________
Then this is the second test:
server | --- deploy | | | --- ear-deployer.xml (isolated parameter setted to true) | | | --- TestCase1.ear | | | | | --- TestCase1.war | | | | | --- WEB-INF | | | | | --- classes | | | | | --- myServlet.class | | | --- TestCase2.ear | | | | | --- TestCase2.war | | | | | --- WEB-INF | | | | | --- classes | | | | | --- myServlet.class | | --- lib | | | --- mySingleton.jar
RESULT: The servlets print the same fully qualifiedName, the same classloader (UnifiedClassLoader3) AND the same memory addresses. This is very troublesome because this is not what I was waiting.
I fully understand why they are loaded by the same UCL. For me, every jars in the lib directory of the server are shared libraries. But I don't understand why instances are shared between ears.
Is this some kind of bug? Or is there another "shared lib directory" to do what I try to do?
Regards,
J. Guyard