1 Reply Latest reply on Dec 16, 2003 7:45 AM by stanimir

    Problem with a CORBA client calling an EJB

    stanimir

      Hi everybody,
      I have deployed an IIOP enabled EJB on JBOSS.
      My Corba client tries to get the InitialContext in the following manner :

      Properties prope = new Properties();
      prope.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
      prope.put(Context.PROVIDER_URL,"corbaloc::localhost:3528/JBoss/Naming/root");
      try {
      context = new InitialContext(prope);
      } catch (NamingException e) {
      e.printStackTrace();
      }


      I start JBoss server using the following command line:

      run -c all --host=localhost

      I use the following VM parameters:

      -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -Djava.security.policy=.\java.policy

      When I try to get a reference to the home interface of my EJB
      using the lines below

      Object ref = context.lookup("jndiName");
      XXXHome home =
      (XXXHome) PortableRemoteObject.narrow(ref,XXXHome.class);


      I get the following exception:

      java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)

      Can anybody help me understand what is going on??

      My Object ref is of type org.jacorb.orb.Reference.
      Is this the correct type I should receive when looking up from the InitialContext??

      Thank you very much.
      Stan.