posted 20 years ago
Hi.
We are migrating from weblogic6.1 to was5.
While executing this code
UserHome myHome = (UserHome) ic.lookup("UserHome");
Collection col = UserHome.findByName( name );
Iterator it = col.iterator();
while ( it.hasNext() ){
!!! User user =( User ) it.next(); !!!
. . .
}
we get ClassCastException: _EJBObject_Stub
It only takes place when find method returns Collection, methods which return bean allow explicit cast. They return _User_Stub instead of
_EJBObject_Stub. It's very strange behavior.
I know that RMI-IIOP requires using
(User) PortableRemoteObject.narrow(it.next(), User.class) to avoid this exception. It works fine in this case. But it's hard to change all such places.
Can anybody advise alternative way to fix the exception?
Assembly Tool compiles bean with -iiop rmic option by default. May it help if I compile bean without this option or it causes a crash of deployment?
Is it possible to use RMI instead of RMI-IIOP?