In JBoss 4.0.5 GA (ejb3 profile)
I consider the following code in the EJBTrail example (inside the jsp calculator page that call a Stateful Calculator bean):
Calculator cal = (Calculator) session.getAttribute("sfsb_cal"); if (cal == null) { try { InitialContext ctx = new InitialContext(); cal = (Calculator) ctx.lookup( "StatefulCalculator/remote"); session.setAttribute ("sfsb_cal", cal); } catch (Exception e) { e.printStackTrace (); } }
Calculator cal = (Calculator) session.getAttribute("sfsb_cal");
Calculator cal = null;