Discussions

EJB programming & troubleshooting: Class cast exception while using Custom finder methods

  1. Hello,

            We are facing a problem of class cast exception . We have a custom finder method in one of our ejb home . This finder method returning Enumeration which contains corresponding remote object. But sometimes it is not returning remote object instead of it returns org.omg.stub.javax.ejb._EJBObject_Stub This causing class cast exception. Could you please help me to find out this problem.

     For custom finder method we are following BeanFinderHelper interface (According to IBM specification)

    Thanks
    jeevan
  2. Hi,

    I has a similar problem getting implementation objects back from finders in IAS 4.5, when I was expecting remote interfaces. I got round it by narrowing the return object like this:

    //
    Object o = (Object)li.next();
    Entity entity = (Entity)javax.rmi.PortableRemoteObject.narrow(o, Entity.class);

    Hope this helps,

    James