This tip shows the way to look up Object in Distributed Name Space:

  Hashtable props = new Hashtable();
        props.put("java.naming.factory.initial""com.sun.jndi.cosnaming.CNCtxFactory");
        props.put("java.naming.provider.url""iiop://192.168.0.22:2215");
       
   Context c = new InitialContext(props);
        Object o = c.lookup("ejb/BankMgr");
        BankMgrHome bankMgrHome = (BankMgrHome)PortableRemoteObject.narrow(o,  BankMgrHome.class);

Where Bankmgr is JNDI name of An EJB and BankmgrHome is Component Home Interface of BankMgr EJB.