1 package test; 2 3 import javax.ejb.*; 4 5 10 public class TestWebService1Bean 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 58 61 64 public int sum(int a, int b) throws java.rmi.RemoteException { 65 return lookupTestSession3Bean().sum(a,b); 66 } 67 68 private test.TestSession3Remote lookupTestSession3Bean() { 69 try { 70 javax.naming.Context c = new javax.naming.InitialContext (); 71 Object remote = c.lookup("java:comp/env/ejb/TestSession3Bean"); 72 test.TestSession3RemoteHome rv = (test.TestSession3RemoteHome) javax.rmi.PortableRemoteObject.narrow(remote, test.TestSession3RemoteHome.class); 73 return rv.create(); 74 } 75 catch(javax.naming.NamingException ne) { 76 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne); 77 throw new RuntimeException (ne); 78 } 79 catch(javax.ejb.CreateException ce) { 80 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce); 81 throw new RuntimeException (ce); 82 } 83 catch(java.rmi.RemoteException re) { 84 java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,re); 85 throw new RuntimeException (re); 86 } 87 } 88 89 90 91 } 92 | Popular Tags |