[jboss-user] Intra-EAR classloading problem

Nebojsa Bozovic nb at stiffjazz.com
Fri Sep 7 18:06:20 EDT 2007


Hi,

I have an EAR application containing a connector RAR and EJB3 JAR. My
connector contains some classes which implement Serializable. Everything
worked fine until I tried to put an instance of such a class in an
ObjectMessage and then into a JMS queue from my EJB3 code, but now I get
ClassCastExceptions when trying to get the instance back out.

It seems that when the instance is deserialized and I try to cast it to
the original type, the class literal of the type I am trying to cast it
to and the runtime class of ObjectMessage.getObject() are loaded by
different ClassLoaders, which I can confirm simply by printing them out.
One of them has a URL pointing to the deployed EAR; the other has a null
URL.

I've tried defining a loader-repository for my EAR and using the class
preload service, but neither had any effect on the problem. I've tried
listing the types in question out in the loader-repository MBean using
the JMX console, but only one InstanceN/CodeSource ever appears.

The problem seems not to manifest itself after a fresh start of the
server. I can only get CCEs after I re-publish the EAR from Eclipse.

What can be done?




More information about the jboss-user mailing list