aspose file tools*
The moose likes Websphere and the fly likes  EJB 3 remote client - java.lang.ClassCastException: Unable to load class: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark " EJB 3 remote client - java.lang.ClassCastException: Unable to load class: " Watch " EJB 3 remote client - java.lang.ClassCastException: Unable to load class: " New topic
Author

EJB 3 remote client - java.lang.ClassCastException: Unable to load class:

sanker san
Ranch Hand

Joined: Dec 17, 2004
Posts: 56
I tried to invoke the remote interface (RemoteCounter) from a standalone java program. I'm able to lookup the service but when I tried to narrow it, it gave this error. The envt used is Websphere 6.1 with EJB3 fixpack.

Client code snippet:-
Object svc1 = serviceLocator.getService("ejb/EJB3CounterSample/EJB3Beans.jar/StatelessCounterBean#com.ibm.websphere.ejb3sample.counter.RemoteCounter");
Object obj = PortableRemoteObject.narrow(svc,RemoteCounter.class);

Error:-
INFO P=24704 =0:CT (com.util.ServiceLocator:92) - ServiceLocator : getService() : EndIOR:00bdbdbd00000048524d493a636f6d2e69626d2e7765627370686572652e656a623373616d706c652e636f756e7465722e52656d6f7465436f756e7465723a30303030303030303030303030 30303000000000010000000000000184000102bd0000001b62726d73746777656277617330312e62726f636164652e636f6d00bd26acbdbd000000bd4a4d4249000000124773e3aa376430626337373 3 6533616166633334000000240000009949454a500200f2d6cc71077365727665723103454a420000007fadac000200010000000032000000636f6d2e69626d2e7765627370686572652e656a6233736 1 6d706c652e636f756e7465722e52656d6f7465436f756e746572acac000200010134000000454a4233436f756e74657253616d706c6523454a42334265616e732e6a61722353746174656c657373436 f 756e7465724265616ebdbdbd0000000a000000010000001400bdbdbd0501000100000000000101000000000049424d0a0000000800bd00011500000100000026000000020002bdbd49424d040000000 5 0005020102bdbdbd0000001f0000000400bd0003000000200000000400bd000149424d04000000050005020102bdbdbd0000001f0000000400bd0003000000200000000400bd0001000000250000000 4 00bd0003
java.lang.ClassCastException: Unable to load class: com.ibm.websphere.ejb3sample.counter._RemoteCounter_Stub
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:372)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:156)
at com.util.ServiceLocator.main(ServiceLocator.java:151)
sanker san
Ranch Hand

Joined: Dec 17, 2004
Posts: 56
This has been resolved.

As it was a standalone client, I had to generate the stubs using createEJBStubs.sh and put it in the client's classpath.
 
wood burning stoves
 
subject: EJB 3 remote client - java.lang.ClassCastException: Unable to load class: