Hi!

Sylvain Laurent wrote:
> I'm working on integrating Tomcat in jBoss 2, as a MBean.
> 
> I managed to solve all the class loading problems (yes, I'll commit
> everything soon), but now I'm running into Proxy problems...
> 
> I made a simple EJB Stateless Bean client which can be invoked either
> stand-alone, or from a servlet (thus running inside the same VM as jBoss,
> since Tomcat is now in it).
> 
> The stand alone client works flawlessly, but the servlet fails
> 
> Object slHome = ctx.lookup("nextgen.StatelessSession");
> // works OK, but then
> StatelessSessionHome  statelessSessionHome = (StatelessSessionHome) slHome;
> // fails
> 
> I get a ClassCastException. In both cases the class of slHome is $Proxynn
> (where nn is a number). If I watch the interfaces implemented by this class
> (slHome.getClass().getInterfaces() ), I do have
> org.jboss.zol.testbean.interfaces.StatelessSessionHome in both cases...
> 
> So what's the problem ? Is it something which deals with the hack which
> optimizes intra-VM calls ?

Yes. The interface is loaded twice by different classloaders. The fix is
to not only detect in-VM, but also see if it is the proper classloader.
In all other cases a copy must be made.

I will look into this. 

You can make this work right now by simply turning off local
optimizations in the container configurations (I think, let me know if
it doesn't work anyway).

/Rickard

-- 
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com

Reply via email to