1 package test; 2 3 import javax.ejb.*; 4 5 10 public class TestWebService2Bean implements javax.ejb.SessionBean { 11 private javax.ejb.SessionContext context; 12 13 19 public void setSessionContext(javax.ejb.SessionContext aContext) { 20 context = aContext; 21 } 22 23 26 public void ejbActivate() { 27 28 } 29 30 33 public void ejbPassivate() { 34 35 } 36 37 40 public void ejbRemove() { 41 42 } 43 45 49 public void ejbCreate() { 50 } 55 56 57 private test.TestSession3Remote lookupTestSession3Bean() {try { 58 javax.naming.Context c = new javax.naming.InitialContext (); 59 Object remote = c.lookup("java:comp/env/ejb/TestSession3Bean"); 60 test.TestSession3RemoteHome rv = (test.TestSession3RemoteHome) javax.rmi.PortableRemoteObject.narrow(remote, test.TestSession3RemoteHome.class); 61 return rv.create(); 62 } catch(javax.naming.NamingException ne) { 63 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne); 64 throw new RuntimeException (ne); 65 } catch(javax.ejb.CreateException ce) { 66 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce); 67 throw new RuntimeException (ce); 68 } catch(java.rmi.RemoteException re) { 69 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,re); 70 throw new RuntimeException (re); 71 } 72 } 73 74 75 78 81 public int count(int a, int b) throws java.rmi.RemoteException { 82 return lookupTestSession3Bean().sum(a,b); 83 } 84 85 86 87 } 88 | Popular Tags |