Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ClassCastException when performing PortableRemoteObject.narrow

843830May 23 2005 — edited Jun 6 2008
Hi,

I'm trying to do a lookup to bean:

Object obj = ctx.lookup( "ejb/myPackage/mySessionBeanHome" );
javax.rmi.PortableRemoteObject.narrow( obj, mySessionBeanHome.class );

and I'm getting the following exception:

Exception in thread "P=874250:O=0:CT" java.lang.ClassCastException: cannot cast class org.omg.stub.java.rmi._Remote_Stub to interface myPackage.mySessionBeanHome
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:409)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:156)
at myPackage.MyClient.main(MyClient.java:73)


I investigated the object that returned from the lookup:

Class Name:
org.omg.stub.java.rmi._Remote_Stub

Methods:
0)_ids
1)hashCode
2)equals
3)toString
4)connect
5)_get_codebase
6)_get_delegate
7)_set_delegate
8)_duplicate
9)_release
10)_is_a
11)_is_equivalent
12)_non_existent
13)_hash
14)_request
15)_create_request
16)_create_request
17)_get_interface_def
18)_orb
19)_get_policy
20)_get_domain_managers
21)_set_policy_override
22)_is_local
23)_servant_preinvoke
24)_servant_postinvoke
25)_request
26)_invoke
27)_releaseReply
28)getClass
29)notify
30)notifyAll
31)wait
32)wait
33)wait

Fields:
None

Constructors:
0)org.omg.stub.java.rmi._Remote_Stub


How come the lookup not return my home interface?

Thanks,
Alon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2008
Added on May 23 2005
5 comments
1,180 views