0 Replies Latest reply on Dec 11, 2003 10:16 AM by pwijntjes

    CastCastException

    pwijntjes Newbie

      Dear forum,

      We are running into problems calling a Session bean remotely. We use the following snippet of code too (try) to instantiate the home interface of the bean. But we receive a ClassCastException during the call to narrow. when we inspect the object reference returned by lookup the result of objref.getClass().getInterfaces() is empty.

      Seems we don't have the local stub present although the client should have access to Home and Remote interface of the EJB through CLASSPATH


      java.util.Properties properties = System.getProperties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, com.sun.jndi.cosnaming.CNCtxFactory");
      properties.put(Context.PROVIDER_URL, corbaloc::localhost:3528/JBoss?/Naming/root");

      Context ctx = new InitialContext?(properties);

      Object objref = ctx.lookup("test/MyTestSessionBean");
      testSessionBean = (MyTestSessionHome?)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);




      jboss.xml used [partial]:
      <ejb-name>MyTestSession</ejb-name>
      <jndi-name>test/MyTestSessionBean</jndi-name>
      <configuration-name>Standard Stateless SessionBean</configuration-name>
      <invoker-bindings>

      <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name>


      <invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-binding-name>

      </invoker-bindings>