[jboss-user] [JCA/JBoss] - Classloading and sharing classes between .ear and .rar

rupertlssmith do-not-reply at jboss.com
Thu Aug 3 13:50:26 EDT 2006


I have a resource adapter that I have written and succesfully called from an application. Both were deployed seperately using the default server on JBoss 4.0.4 (as supplied in the distribution with its flat class loading).

Recently, I've had to start using isolated class loading for my application because I'm using JAXB 2.0 which conflicts with the JAXB libraries integrated into JBoss (in the default/lib directory). Now, I'm having problems sharing classes between my .ear and my .rar. I've taken the steps described in the WIKI to make JBoss J2EE compliant by turning on call-by-value. The trouble is that I have to share some classes between the application and resource adapter (the ones that implement cci.ConnectionSpec) so these classes are duplicatied between the .rar and .ear files. 

With flat class loading this wasn't a problem, presumably the class loader just took whichever it found first and ignored the other. With isolated class loaders I get class cast exceptions. I'm surprised by this having taken steps to ensure call-by-value is turned on because I thought this would serialize the objects passed to the resource adapter (like a call between ejb's in different .ears would be) but this doesn't seem to be happening.

One solution I tried is to deploy the .rar inside my .ear instead; the idea being to put all shared .jars at the top level of the .ear. However, I can't get this working, despite adding a connector module statement to my application.xml and a service module statement to my jboss-app.xml. It tries to deploy the -ds.xml service descriptor but just seems to ignore the connector module statement concerning the .rar file?

The other solution I may turn to, is simply to put the ConnectionSpecImpl (and whatever other shared classses are needed) into a /lib directory and not include them in either the .rar or the .ear so I know there is only one instance of them. Its a little less modular and clean and J2EE compliant but on the upside I can probably turn off call-by-value semantics doing it that way.

Does anyone have a working example of deploying a .rar inside an .ear and could shed some light on how to get this working?

Should .rar files be deployed with isolated class loaders and call-by-value semantics? Does anyone know if there is a way to do this? I didn't see a statement inside the rar deployer config xml like in the ear deployer xml to do this.

Thanks for reading and for any help you are able to give.

Rupert Smith


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962960#3962960

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962960



More information about the jboss-user mailing list