Bug 1274161 - Add closing sample code for scoped EJB client context
Add closing sample code for scoped EJB client context
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: eap-docs
Depends On:
  Show dependency treegraph
Reported: 2015-10-22 03:30 EDT by Eiichi Nagai
Modified: 2015-10-27 15:51 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Build Name: 23088, Development Guide-6.4 Build Date: 08-10-2015 17:02:57 Topic ID: 14110-592100 [Latest]
Last Closed: 2015-10-27 15:51:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eiichi Nagai 2015-10-22 03:30:11 EDT
Title: Configure EJBs Using a Scoped EJB Client Context

8.5.5. Configure EJBs Using a Scoped EJB Client 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.
final Properties props = new Properties();
// mark it for scoped EJB client context
// add other properties
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
} finally {
    try {
        // close the EJB naming JNDI context
    } catch (Throwable t) {
        // log and ignore
    try {
        // also close our other JNDI context since we are done with it too
    } catch (Throwable t) {
        // log and ignore
Comment 1 anrobert 2015-10-27 15:51:44 EDT
Migrated to JIRA: https://issues.jboss.org/browse/JBEAP-1665

Note You need to log in before you can comment on or make changes to this bug.