1 Reply Latest reply on Jan 6, 2008 10:20 PM by Ragav Gomatam

    Can I access ejb3.0 via corba?

    Zhang guoming Newbie

      hello,I want to access my ejb3 through corba,how should I do?
      Please give me an examlpe,and tell me the step to use corba acess ejb3 component.
      Thanks a lot!

        • 1. Re:  Can I access ejb3.0 via corba?
          Ragav Gomatam Novice

          I have the snippet attached for accessing ejb via Corba. I had done it with ejb 2.0 in a distributed environment. using the undermentioned snippet For jboss I think you will have to run the "all" configuration that supports iiop. So you might want to start server with run -c all. Also deploy to the "all" configuration & check it out.

          import javax.naming.Context;
          import javax.naming.InitialContext;
          import org.omg.CORBA.ORB;
          import org.omg.CosNaming.NamingContextExt;
          import org.omg.CosNaming.NamingContextExtHelper;
          // Obtaining a reference to the server ORB
          Context initialContext = new InitialContext();
          ORB orb = (ORB) initialContext.lookup("java:comp/ORB");
          //Invoking resolve_initial_references
          // Obtain ORB reference as shown in examples earlier in this section
          org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService");
          NamingContextExt initCtx = NamingContextExtHelper.narrow(obj);
          //Steps above illustrate getting Initial Context with CosNaming
          // Look up the home interface using the name under which the EJB home is //bound (assuming AccountEjb)
          org.omg.CORBA.Object ejbHome = orb.string_to_object(
          accountHome =
           (AccountHome)javax.rmi.PortableRemoteObject.narrow(ejbHome, AccountHome.class);