System.exit(2);
}
System.out.print("Looking up BankApplicationHome ...");
// Connecting to BankApplicationHome thru JNDI
BankApplicationHome bah = null;
try {
bah = (BankApplicationHome) PortableRemoteObject.narrow(
initialContext.lookup("BankApplicationHome"),
BankApplicationHome.class);
} catch (Exception e) {
e.printStackTrace();
System.err.println("Cannot lookup BankApplicationHome: " + e);
System.exit(2);
}
System.out.println("done");
/*
System.out.print("Looking up java:comp/UserTransaction ...");
// We want to start transactions from client: get UserTransaction
UserTransaction utx = null;
try {
utx = (UserTransaction) initialContext.lookup("java:comp/UserTransaction");
} catch (Exception e) {
System.err.println("Cannot lookup UserTransaction: " + e);
System.exit(2);
}
System.out.println("done");
*/
BankApplication ba = null;
String[] accountNumbers = new String[clientsNames.length];
try {
ba = bah.create();
System.out.println("Bank created or loaded");
for (int i = 0; i < agencyNames.length; i++) {
ba.createAgency(agencyNames[i]);
System.out.println("Agency '" + agencyNames[i] + "' created");