Refer to this when a class cast exception is encountered.
If a class cast exception such as this:
at java.lang.reflect.Method.invoke(Native Method)
is encountered when accessing the beans in a returned collection (if a "findAll" type method has been executed), an EntityBean remote interface was expected, but a generic object stub was returned.
It is likely that the objects in the returned collection need to be narrowed to the correct type. For example, if the EJB call set up an employees variable for the collection being returned, you could convert the objects in that collection as follows:
java.util.Collection c =
java.util.Iterator iter = c.iterator();
java.util.Collection c2 = new java.util.Vector();
Object o = iter.next();
o = javax.rmi.PortableRemoteObject.narrow(o, com.bowstreet.ejb.Employee.class);
You would substitute your variable for employees
and the class name you expect for com.bowstreet.ejb.Employee
in the example.
Parent topic: EJB Call builder