ClassCastException when looking up an EJB in JBuilder6/BES 5.0


EJB programming & troubleshooting: ClassCastException when looking up an EJB in JBuilder6/BES 5.0

  1. Hello,

    I have developed an EJB using JBuilder 6 Enterprise. After that, I have created an EJB Test Client to test if my EJB works. I have started embedded container and deployed the EJB into it successfully.

    However, when I tried to run the client, it threw java.lang.ClassCastException on PortableRemoteObject.narrow() operation, saying that stub is not compatible.

    I tried to create a JSP in a web application as a client using embedded Tomcat, but received the same exception when tried to lookup the EJB.

    So, how should I configure JBuilder 6 and/or embedded BES so that a client (remote or embedded) could lookup up and narrow the EJB successfully?

    Thank you very much in advance,
    Sergei Batiuk.
  2. Sergei,

    I do not have the details, but there should be no reason for a ClassCastException to be thrown when you're performing a PRO.narrow() on a remote home interface.

    Can you just create a simple session bean with a test method, and then using the wizards, create an ejb test client and try accessing the method on that EJB?