1 22 package org.jboss.tutorial.reference21_30.bean; 23 24 import javax.ejb.Remote ; 25 import javax.ejb.RemoteHome ; 26 import javax.ejb.Stateless ; 27 import javax.naming.InitialContext ; 28 import javax.ejb.EJB ; 29 import javax.ejb.EJBs ; 30 31 import org.jboss.annotation.ejb.RemoteBinding; 32 import org.jboss.ejb3.Container; 33 34 import org.jboss.logging.Logger; 35 36 40 @Stateless (name="Stateless3") 41 @Remote (Stateless3.class) 42 @RemoteBinding(jndiBinding="Stateless3") 43 @RemoteHome (Stateless3Home.class) 44 @EJBs ({@EJB (name="injected/Stateless2", mappedName="Stateless2")}) 45 public class Stateless3Bean 46 implements Stateless3 47 { 48 private static final Logger log = Logger.getLogger(Stateless3Bean.class); 49 50 @EJB (name="ejb/Stateless2") 51 private Stateless2Home stateless2Home=null; 52 53 public void testAccess() throws Exception 54 { 55 Stateless2 test2 = stateless2Home.create(); 56 try { 57 InitialContext jndiContext = new InitialContext (); 58 Stateless2Home home = (Stateless2Home)jndiContext.lookup(Container.ENC_CTX_NAME + "/env/injected/Stateless2"); 59 test2 = home.create(); 60 } catch (Exception e) 61 { 62 e.printStackTrace(); 63 } 64 } 65 } 66 | Popular Tags |