1 22 package org.jboss.ejb3.test.exception; 23 24 import javax.annotation.Resource; 25 import javax.ejb.Remote ; 26 import javax.ejb.SessionContext ; 27 import javax.ejb.Stateful ; 28 import javax.ejb.TransactionManagement ; 29 import javax.ejb.TransactionManagementType ; 30 import javax.naming.InitialContext ; 31 import javax.naming.NamingException ; 32 import org.jboss.logging.Logger; 33 34 38 @Stateful 39 @TransactionManagement (TransactionManagementType.CONTAINER) 40 @Remote (Foo1.class) 41 public class FooBean1 implements Foo1, java.io.Serializable 42 { 43 private static final Logger log = Logger.getLogger(FooBean1.class); 44 45 private String status = "init"; 46 47 @Resource 48 private SessionContext ctx; 49 50 public void bar() throws FooException1 51 { 52 try 53 { 54 InitialContext jndiContext = new InitialContext (); 55 Foo2 foo2 = (Foo2) jndiContext.lookup("FooBean2/remote"); 56 foo2.bar(); 57 } catch (NamingException e) 58 { 59 throw new FooException1(e.getMessage()); 60 } catch (FooException2 e) 61 { 62 status = "Caught FooException1"; 63 throw new FooException1(e.getMessage()); 64 } 65 } 66 67 public String getStatus() 68 { 69 return status; 70 } 71 72 } | Popular Tags |