JBoss: Scoped beans & Remote classloader issue

JBoss: Scoped beans & Remote classloader issue

Post by cruinn » Fri, 23 Jul 2004 21:07:42


In a JBoss 3.2.4 server, I have deployed several enterprise javabeans
(each as a separate .jar, not in an .ear bundle). These beans are
completely self-contained, as they include all their needed
dependencies inside the jar files (and have a reference to them in the
Class-Path entry in their MANIFEST.MF).

The problem shows when I want these beans to be scoped, this is, to
have their own classloader inside JBoss and not use the unified
classloader so that each bean does not see the others' classes,
something very important for my software architecture. For this, I set
in the jboss.xml file of each of my ejb .jar files the following:

<loader-repository>some.dot.com:loader=[some unique

And in the jboss-service.xml file I enable CallByValue for the EJB

...and with this I get the results I expected. The problem is, I need
some of my ejbs to return to the web tier classes of which this web
tier only has an interface (not the real implementations, which may
vary). This means that, when the web tier receives the data, it should
ask JBoss for the concrete implementation of the class via Remote
Class Loading. For this, I have set in jboss-service.xml:

<mbean code="org.jboss.web.WebService"
<attribute name="Port">8083</attribute>
<attribute name="DownloadServerClasses">true</attribute>
<attribute name="Host">${jboss.bind.address}</attribute>
<attribute name="BindAddress">${jboss.bind.address}</attribute>

Which made remote classloading work perfectly before I scoped my ejbs,
and which now simply makes JBoss return a ClassNotFoundException when
tomcat asks for the implementation class.

I supose this means that the remote classloader cannot access the
ejbs' concrete classloaders now they're not unified but... Can this
behaviour be changed? Can I configure it some way so that I can do
remote classloading with scoped beans?