0 Replies Latest reply on Nov 25, 2004 3:22 AM by Yury Mikhienko

    EJB remoting solution

    Yury Mikhienko Newbie

      Can anyone have the success story of connect to EJB over rmi/iiop transport?

      Can I get the connection to EJB over "pure" corba iiop transport? (generating client stubs from IDL, initialize ORB, etc.) I try but get CORBA BAD_PARAM errors :((

      If I use the rmi/iiop transport (solution from http://www.jboss.org/developers/projects/jboss/IIOP)
      I get the ClassCastException :((
      My client code in this case:

      public static void main(String[] args) {
      lbsGW = getEjb();
      }

      private static LbsGWu getEjb() throws NamingException, CreateException, RemoteException {
      javax.naming.Context context = getContext();
      System.out.println("after getContext");
      java.lang.Object obj = context.lookup("LbsGWUniformHomeRemote");
      if(obj != null) {
      try {
      return ((LbsGWuHome) javax.rmi.PortableRemoteObject.narrow(obj,LbsGWuHome.class)).create();
      }catch (Exception e) {
      e.printStackTrace();
      return null;
      }
      }
      return null;
      }


      private static javax.naming.Context getContext() throws NamingException {

      Properties p = new Properties();
      p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
      p.put(javax.naming.Context.PROVIDER_URL, "corbaloc:iiop:localhost:3528/JBoss/Naming/root");
      System.out.println("create InitialContext");

      try {
      javax.naming.Context ctx= new InitialContext(p);

      return ctx;
      }catch (Exception e) {
      e.printStackTrace();
      return null;
      }
      }

      LbsGWuHome and LbsGWu - home and remote EJB interfaces, generates from XDoclet.

      exception rises in return ((LbsGWuHome) javax.rmi.PortableRemoteObject.narrow(obj,LbsGWuHome.class)).create();
      step