public void lookupStatelessBean() throws TestFailureException { try { try { BasicStatelessHome home = (BasicStatelessHome) ejbContext.lookup("stateless/beanReferences/stateless"); Assert.assertNotNull("The EJBHome looked up is null", home); BasicStatelessObject object = home.createObject(); Assert.assertNotNull("The EJBObject is null", object); } catch (Exception e) { Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage()); } } catch (AssertionFailedError afe) { throw new TestFailureException(afe); } }
public void lookupStatelessBean() throws TestFailureException { try { try { final InitialContext ctx = new InitialContext(); Assert.assertNotNull("The InitialContext is null", ctx); final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateless/beanReferences/stateless"), BasicStatelessHome.class); Assert.assertNotNull("The EJBHome looked up is null", home); final BasicStatelessObject object = home.createObject(); Assert.assertNotNull("The EJBObject is null", object); } catch (final Exception e) { Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage()); } } catch (final AssertionFailedError afe) { throw new TestFailureException(afe); } }