try{
Context jndiContext = getInitialContext();
CustomerHome ch = (CustomerHome)jndiContext.lookup("CustomerHome");
CustomerPK pk = new CustomerPK();
pk.id = 1;
Customer customer = ch.findByPrimaryKey(pk);
TravelAgentHome home = (TravelAgentHome)jndiContext.lookup("TravelagentHome");
TravelAgent agent = home.create(customer);
agent.setCruiseID(1);
String list [] = agent.listAvailableCabins(2);
for(int i = 0; i < list.length; i++){
System.out.println(list[i]);
}
agent.setCabinID(1);
GregorianCalendar gc = new GregorianCalendar();
gc.set(1999,10,31);
CreditCard card = new CreditCard(83872938749209l,gc.getTime() , CreditCard.VISA);
Ticket t = agent.bookPassage(card,27999.99d);
System.out.println(t);
}catch(java.rmi.RemoteException re)
{
System.out.println("RemoteException thrown");
re.printStackTrace();
if(re.detail != null)
re.detail.printStackTrace();
}
catch(Throwable t)
{
t.printStackTrace();
}