Hello,

Firstly I know there is a lot of discussion on this point, but I can't find 
anything that describes my problem exactly.

To emphasize up front:

1. My app is not distributed between two ears (I don't have a hot deploy of 
partial app issue)
2. The EXACT same ear works in 4.0.1 but not in 4.0.2

The problem:

The code (which is in a Servlet):

Context ctx = new InitialContext();
Object o = ctx.lookup("ejb/TSmartAdmin");
Class target = TSmartAdminHome.class;
TSmartAdminHome home = (TSmartAdminHome)PortableRemoteObject.narrow(o, 
TSmartAdminHome.class);

causes:

java.lang.ClassCastException
        
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
        javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
        
com.tigerreef.templatesmart.servlet.NavServlet.lookupTSmartAdmin(NavServlet.java:397)


but ONLY when deplyed to a JBOSS 4.0.2 server (works fine on 4.0.1).

Additional the same code run in a testClient running within Eclipse runs fine.

It seems to me that the problem is to do with Class loaders. So, added the 
follwoing code after I have the object ref "o":

System.out.println("Servlet>>>>>> o's CL: " + o.getClass().getClassLoader() + " 
target's CL: " + target.getClassLoader());

and on 4.0.2 I get:

Servlet>>>>>> o's CL: [EMAIL PROTECTED] 
url=file:/C:/jboss-4.0.2/server/default/tmp/deploy/tmp27550TSmartApp.ear 
,addedOrder=40} target's CL: WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

Two different class loaders, used for the EJB tier and the Web tier (both from 
the same ear running in the same JVM - my unserstanding is JBoss is supposed to 
optimise this.)

I tried the same thing on 4.0.1:

and get:

Servlet>>>>>> o's CL: [EMAIL PROTECTED] 
url=file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp7498TSmartApp.ear 
,addedOrder=39} target's CL: [EMAIL PROTECTED] 
url=file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp7498TSmartApp.ear 
,addedOrder=39}

NOTE UnifiedClassLoader in both cases....

And now I am stumped. I see a lot of people having problems with comms between 
two different ears and hot deploys of one of them due to dangling references, 
but I don't think this is in that category. To reiterate - ONE ear - everything 
deployed fresh (at the same time), the same problem occurs if I start the 
server form the command line or from within Eclipse AND the EXACT same ear 
works fine in 4.0.1.

Please help!
PJ




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

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


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to