[jboss-user] [JBoss Microcontainer] - Re: More on BaseClassLoader conflict with Instrumentation....

Ales Justin do-not-reply at jboss.com
Fri Feb 18 18:43:29 EST 2011

Ales Justin [http://community.jboss.org/people/alesj] created the discussion

"Re: More on BaseClassLoader conflict with Instrumentation...."

To view the discussion, visit: http://community.jboss.org/message/588434#588434

> * The classes in the BaseClassLoader pick up the classes from the sun Class Loader just fine - evidently, the BaseClassLoader IS delegating to thesun base Class Loader EVEN THOUGH it shows that it's parent is NOT the base loader (which I normally see), but instead the parent being
> null indicating a native or boot loader.
System Classloader

> * The problem comes when code in the sun loader is called by the code in the BaseClassLoader and the javax.jms.Session interface seems to be loaded into the BaseClassLoader from jms.jar in the WAR (self first? as it DID NOT delegate down to the sun Class Loader) and all comesapart when a class impl for javax.jms.Session created in the BaseClassLoader is then cast to javax.jms.Session in the sun Class Loader and
> because they were loaded in 2 different class loaders they are not considered the same class and we get a Class Cast Exception.
Why exactly do you need that jms.jar in .war?

Self first is per the spec for web/.war deployments.
> ***** I want to either at runtime set the Classpath for the BaseClassLoader to my instrumentation classes which would resolve this issue ORforce ALL class loaders to delegate downstream to the jms.jar that I loaded in the sun AppClassLoader....
> **  
Add jboss-classloading.xml with parent-first=true attribute.

If you want that the rest of classes (non jms.jar) are still looked parent-first=false, you need a bit more work.
The new jboss-classloading-domain.xml in AS6 helps here, but unfortunately it has a few bugs, which are already fixed,
and as such will be part of next AS6.1 release.

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110218/6e3b0a80/attachment.html 

More information about the jboss-user mailing list