prop2.put("java.naming.provider.url", "jnp://" + args[1]);
System.out.println("Saving customer to node1 = " + args[0]);
InitialContext ctx1 = new InitialContext(prop1);
EntityTest tester1 = (EntityTest)ctx1.lookup("EntityTestBean/remote");
Customer customer = tester1.createCustomer();
customer = tester1.findByCustomerId(customer.getId());
System.out.println("Looking for customer on node2 = " + args[1] + " (should be available in cache)");
InitialContext ctx2 = new InitialContext(prop2);
EntityTest tester2 = (EntityTest)ctx2.lookup("EntityTestBean/remote");
Set<Contact> contacts = customer.getContacts();
customer = tester2.findByCustomerId(customer.getId());
if (customer == null)
{
throw new RuntimeException("Customer was not found in node2 = " + args[1]);
}
System.out.println("Found customer on node2 (cache). Customer details follow:");