1 27 28 package checker; 29 30 import java.util.*; 31 import javax.naming.*; 32 import javax.rmi.PortableRemoteObject ; 33 34 35 public class CheckerClient { 36 public static void main(String [] args) { 37 try { 38 Context initial = new InitialContext(); 39 Object objref = initial.lookup("ejb/SimpleChecker"); 40 41 CheckerRemoteHome home = (CheckerRemoteHome) PortableRemoteObject.narrow(objref, CheckerRemoteHome.class); 42 43 CheckerRemote checker = home.create("Duke"); 44 45 double discount = checker.applyDiscount(6000.00); 46 47 System.out.println("discount = " + String.valueOf(discount)); 48 49 System.exit(0); 50 } catch (Exception ex) { 51 System.err.println("Caught an unexpected exception!"); 52 ex.printStackTrace(); 53 } 54 } 55 } 56 | Popular Tags |