What are the allowed JNDI name formats for EJBs in EAP 7 / 6 according to EE6+
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
- 6.x
Issue
- What are the JNDI name formats allowed according to EE6+ specifications and what are their meanings.
- Why can not i specify/access JNDI names like "java:comp/env" for my EJBs in EAP6
- I saw the below examples in the migration guide, when should I use each of these JNDI names?
Old
OrderManagerApp/ProductManagerBean/local
New
java:module/ProductManagerBean!services.ejb.ProductManager
Old
OrderManagerApp/ProductManagerBean/local
New
java:app/OrderManagerEJB/ProductManagerBean!services.ejb.ProductManager
Old
OrderManagerApp/ProductManagerBean/local
New java:app/OrderManagerApp/OrderManagerEJB/ProductManagerBean!services.ejb.ProductManager
- In JBoss EAP following binding details were displayed in the console,
java:global/sampleEar/app1/Hello!com.redhat.HelloObject
java:app/app1/Hello!com.redhat.HelloObject
java:module/Hello!com.redhat.HelloObject
java:jboss/exported/sampleEar/app1/Hello!com.redhat.HelloObject
what is the difference between java:global/ java:app/ java:module/ java:jboss/exported/
-
Which JNDI name format should be used when the ejb is packaged inside the EAR application?
-
Should we use
java:app/as the prefix of names of EJB beans so that it will search within the same EAR ? -
There is an issue where the Jboss Application cannot connect to the Jboss server. previously they use JNDI port 1099 however that port no longer in EAP 6. we replace it with remoting port 4447 . Is there any other files need to be configure/create then please guide.
-
Steps on how to configure JNDI lookup on Jboss instance standalone.xml file.
-
What are the best practice to Deploy Common Ejbs. As I have this situation that there is an enterprise application that contains (WEB.war,EJB.jar). Furthermore this application have to use external EJBs ( ejb1.jar, ejb2.jar, ejb3.jar, common to other application too). My questions are:
- If i embed (insert in the EAR) the 3 external ejbx.jar, will the other applications see those ejbs?
- If i choose to deploy the ejbs as external modules should i deploy them just as "drag-drop" in deployments (in this first phase i'm using the standalone profile but in the production environment i will use domain profile)
- Or should i deploy them as modules JBOSS_HOME/modules ? if i choose this, when i will configure the domain architecture, each applications in the domain will be able to use those ejbs ?
-
In the above case scenario of deploying the external EJBs.jar in JBOSS_HOME/modules, Which is the best practice to add that dependencies to the EAR project?
Resolution
According to JEE6 standards for EJBs. Four JNDI namespaces are used for portable JNDI lookups:
1). java:global,
2). java:module,
3). java:app,
4). java:comp
The java:global JNDI namespace is the portable way of finding remote enterprise beans using JNDI lookups. JNDI addresses are of the following form:
java:global
java:global[/application name]/module name/enterprise bean name[/interface name]
Application name and module name default to the name of the application and module minus the file extension. Application names are required only if the application is packaged within an EAR. The interface name is required only if the enterprise bean implements more than one business interface.
java:module
The java:module namespace is used to look up local enterprise beans within the same module. JNDI addresses using the java:module namespace are of the following form:
java:module/enterprise bean name/[interface name]
The interface name is required only if the enterprise bean implements more than one business interface.
java:app
The java:app namespace is used to look up local enterprise beans packaged within the same application. That is, the enterprise bean is packaged within an EAR file containing multiple Java EE modules. JNDI addresses using the java:app namespace are of the following form:
java:app[/module name]/enterprise bean name[/interface name]
The module name is optional. The interface name is required only if the enterprise bean implements more than one business interface
java:comp
Content from jcp.org is not included.Content from jcp.org is not included.http://jcp.org/en/jsr/detail?id=316 in this link document "3.1.8.2. Portable JNDI Naming Syntax" these namings are described.
More information on this is mentioned within "javaee_platform-6_0-fr-spec.pdf" in section "EE.5 Resources, Naming, and Injection", subsection "EE.5.2.2 Application Component Environment Namespaces", on page 65.
For more details you can refer to the link Content from docs.jboss.org is not included.JNDI Reference in JBoss community.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.