// BankServer.java import BankApp.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; public class BankServer { public static void main(String args[]) { try{ System.out.println("Initializing the ORB"); org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); BankApp.AccountManager manager = new AccountManagerImpl(); orb.connect(manager); // get the root naming context System.out.println("Getting the root naming context ....\n"); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // bind the Object Reference in Naming System.out.println("Binding the Object Reference in Naming Service ....\n"); NameComponent nc = new NameComponent("BankManager", ""); NameComponent path[] = {nc}; ncRef.rebind(path, manager); // wait for invocations from clients System.out.println("Waiting for invocations from the clients ....\n"); java.lang.Object sync = new java.lang.Object(); synchronized (sync) { sync.wait(); } } catch(Exception e) { System.out.println("ERROR : " + e) ; e.printStackTrace(System.out); } } }