Title: Configure EJBs Using a Scoped EJB Client Context 8.5.5. Configure EJBs Using a Scoped EJB Client Context https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/sect-Invoking_Session_Beans.html#Configure_EJBs_Using_a_Map-Based_or_Scoped_Context Describe the issue: Our documentation is explaining about the org.jboss.ejb.client.scoped.context property with sample code. However, it does not mention as to how to close it. If using the scoped EJB client context, it have to look up the root JNDI context for "ejb:" and close it in the finally process. Suggestions for improvement: Like this community documentation. https://docs.jboss.org/author/display/AS72/Scoped+EJB+client+contexts ~~~~ final Properties props = new Properties(); // mark it for scoped EJB client context props.put("org.jboss.ejb.client.scoped.context","true"); // add other properties props.put(....); ... Context jndiCtx = new InitialContext(props); Context ejbRootNamingContext = (Context) jndiCtx.lookup("ejb:"); try { final MyBean bean = ejbRootNamingContext.lookup("app/module/distinct/bean!interface"); // rest of the EJB jndi lookup string bean.doSomething(); } finally { try { // close the EJB naming JNDI context ejbRootNamingContext.close(); } catch (Throwable t) { // log and ignore } try { // also close our other JNDI context since we are done with it too jndiCtx.close(); } catch (Throwable t) { // log and ignore } } ~~~~
Migrated to JIRA: https://issues.jboss.org/browse/JBEAP-1665