In Liberty prior to version 20.0.0.12, Enterprise JavaBeans (EJB) beans were bound only to the
java:[scope]
namespace. EJB beans were not bound to a server root Java Naming and
Directory Interface (JNDI) namespace, which means you could not define
the JNDI binding names. EJB binding attributes that allow you to
specify the JNDI name in WebSphere Application Server traditional were
ignored in Liberty.
The following EJB binding attributes from the ibm-ejb-jar-bnd.xml file were ignored in Liberty.
session simple-binding-namesession component-idsession local-home-binding-namesession remote-home-binding-nameinterface binding-nameThe following EJB binding attributes from the ibm-ejb-jar-bnd.xmi file were ignored in Liberty.
ejbBindings jndiNameThis rule flags all the JNDI binding names that were ignored in Liberty prior to 20.0.0.12. If your application uses these names in direct JNDI lookups rather than using EJB references, you must use Liberty version 20.0.0.12 or newer or modify your application.
If you use EJB references,
the Behavior change on lookups for Enterprise JavaBeans in previous versions of Liberty
rule flags any JNDI names that must be converted to the java: namespace if using a
version of Liberty older than 20.0.0.12.
If you do not use EJB references and are using a version of Liberty older than 20.0.0.12, it is
recommended that you use a newer version of Liberty or create an EJB
reference using the same JNDI name and set the EJB reference binding-name
to the java:[scope] JNDI name. If you do not add an EJB reference,
you must scan your Java code for use of these JNDI names and convert
the lookup name to the java: JNDI name.
The following example creates an EJB reference to help migrate any lookup issues if you are not using Liberty version 20.0.0.12 or newer.
Referenced EJB:
Remote Interface:
The following are examples on how to declare an EJB Reference in Liberty. Either 1a or 1b is required in conjunction with 2a, 2b, 3a, or 3b to successfully link an EJB and its reference. For example, the recommended options are 1a and 2b for an easy and successful setup, but if 1b is declared in conjunction with 3b you will get the same functionality as the recommended setup.
beanName
element must be added to the @EJB annotation. If using an ejb-jar.xml
or web.xml, the <ejb-link> element must be added to the existing
<ejb-ref> element. Modifications to 1a and 1b are shown here:lookup element to the @EJB annotation. If using an
ejb-jar.xml or web.xml, the <lookup-name>
element must be added to the existing <ejb-ref> element. Modifications to 1a and 1b are shown here:
lookup, lookup-name, or binding-name attribute may optionally be used
for referencing EJBs in the same application. In that case, the value may be set to any applicable direct EJB lookup described at the end of this page.
The following is the final EJB reference lookup:
Alternatively, there are three options to lookup an EJB directly, not using an EJB reference:
For more information on using EJB bindings, see Using enterprise JavaBeans with remote interfaces on Liberty and EJB 3.0 and EJB 3.1 application bindings overview.