5 Replies Latest reply on Jul 17, 2003 5:42 AM by bigheadace

    java.lang.ClassCastException

    bigheadace Newbie

      during deplying EJB;
      Always get: java.lang.ClassCastException. from
      Context ctx = new InitialContext();
      Object obj = ctx.lookup("ejb/husky/EntityPC");
      LogRecorder.errorRecord("OBJ is "+obj.toString()); //can got ejb/husky/EntityPCHome.

      ==> EntityPCHome eh = (EntityPCHome)PortableRemoteObject.narrow(obj,EntityPCHome.class);
      Here asn above exception is thrown.

      Followo is relative XML files:

      ejb-jar.xml
      ....

      <display-name>EntityPC</display-name>
      <ejb-name>EntityPC</ejb-name>
      fi.mediweb.husky.ejb.persistency.EntityPCRemoteHome
      fi.mediweb.husky.ejb.persistency.EntityPCRemote
      <local-home>fi.mediweb.husky.ejb.persistency.EntityPCHome</local-home>
      fi.mediweb.husky.ejb.persistency.EntityPC
      <ejb-class>fi.mediweb.husky.ejb.persistency.EntityPCBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      ....

      in web.xml:
      ...

      <ejb-ref>
      <ejb-ref-name>EntityPC</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      fi.mediweb.husky.ejb.persistency.EntityPCHome
      fi.mediweb.husky.ejb.persistency.EntityPC
      <ejb-link>persistency.jar#EntityPC</ejb-link>
      </ejb-ref>

      .....

      in jboss-web.xml:

      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>EntityPC</ejb-ref-name>
      <jndi-name>ejb/husky/EntityPC</jndi-name>
      </ejb-ref>


      </jboss-web>


      Anybody can help me finger out what's hell goning on.

      Thanks fir ur information.