// String host1 = argv[0];
// int port1 = Integer.parseInt(argv[1]);
// String host2 = argv[2];
// int port2 = Integer.parseInt(argv[3]);
String host1 = "orbhost1.net";
int port1 = 1234;
String host2 = "orbhost2.net";
int port2 = 5678;
try {
// Initialize the first ORB reference
Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitialHost", host1);
props.put("org.omg.CORBA.ORBInitialPort", String.valueOf(port1));
ORB orb1 = ORB.init((String[])null, props);
// Initialize another ORB reference
props.put("org.omg.CORBA.ORBInitialHost", host2);
props.put("org.omg.CORBA.ORBInitialPort", String.valueOf(port2));
ORB orb2 = ORB.init((String[])null, props);
// Get references to the Naming Services
org.omg.CORBA.Object nc1Ref =
orb1.resolve_initial_references("NameService");
org.omg.CORBA.Object nc2Ref =
orb2.resolve_initial_references("NameService");
// Narrow the Naming Service references to NamingContexts and use them
}
catch (InvalidName invName) {
System.out.println("No naming service found in one of the ORBs:");
invName.printStackTrace();
}