import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import java.util.Properties; public class ShapeListServer { public static void main(String args[]) { try{ // create and initialize the ORB Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1500"); ORB orb = ORB.init(args, props); //ORB orb = ORB.init(args, null); // create servant and register it with the ORB ShapeListServant shapeRef = new ShapeListServant(orb); orb.connect(shapeRef); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // bind the Object Reference in Naming NameComponent nc = new NameComponent("ShapeList", ""); NameComponent path[] = {nc}; ncRef.rebind(path, shapeRef); // wait for invocations from clients java.lang.Object sync = new java.lang.Object(); synchronized (sync) { sync.wait(); } } catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } } }