4 Replies Latest reply on Mar 6, 2007 5:52 PM by hgsdc

    ClassCastException upon jndi lookup after upgrade from 3.2.8

    hgsdc

      Hi forum.

      I have already searched the forums and wiki and found that this might be class loader related. I just can seem to get it working. Here's the scene:

      I have a web app placed in a war file, say app-web.war
      I have a ejb app placed in a ejb jar file, say app-ejb.jar
      The whole thing is packed in an ear file, say app.ear

      All interfaces are local.

      I get the classcast exception during casting of the found home interface (via jndi) to the concrete home interface:

      In my web app servlet I do:

      MyHome home = (MyHome) ServiceLocator.GetHome(serviceId)

      In the ServiceLocator static class i perform the lookup in jndi:

      // Lookup is just fine
      Object ref = initial.lookup(getServiceName(serviceId));

      // Cast to the common EJBHome interface
      return (EJBLocalHome) ref;

      Upon casting to MyHome interface in servlet I get the class cast exception.

      Can someone instruct me how to exactly pack my app-web.war, app-ejb.jar and the app.ear to overcome this issue?

      I built my ear and it's contents with an ANT script.

      Thanks in advance.

      Regards

      Henrik