ORB orb = ORB.init(argv, null);
org.omg.CORBA.Object ref = null;
try {
ref = orb.resolve_initial_references("NameService");
}
catch (InvalidName invN) {
System.out.println("No primary NameService available.");
System.exit(1);
}
NamingContext nameContext = NamingContextHelper.narrow(ref);
NameComponent topNC = new NameComponent("RemoteContexts", "");
NameComponent subNC = new NameComponent("Naming1", "");
NameComponent path[] = {topNC, subNC };
try {
org.omg.CORBA.Object ref2 = nameContext.resolve(path);
NamingContext nameContext2 = NamingContextHelper.narrow(ref2);
System.out.println("Got secondary naming context...");
}
catch (Exception e) {
System.out.println("Failed to resolve secondary NameService:");
e.printStackTrace();
}