Behavior change on lookups for Enterprise JavaBeans in previous versions of Liberty

In versions of Liberty prior to 20.0.0.12, EJB components were not bound to a server root Java Naming and Directory Interface (JNDI) namespace as they are in WebSphere Application Server traditional, so @EJB lookups and bindings in ibm-ejb-jar-bnd.xml or ibm-web-bnd.xml files might require migration. If not using Liberty 20.0.0.12 or newer, these lookups must use the portable JNDI syntax for EJB components that are hosted within the same server and corbaname: URLs for EJB components that are hosted in another server.

Only the following namespaces were accepted prior to Liberty version 20.0.0.12:

This rule flags @EJB annotations with a lookup attribute value that does not start with one of the namespaces listed above.


//this lookup will be flagged
@Stateless
@EJB(lookup="ejb/myApp/myModule/MyBeanComponent")

This rule also flags string literals starting with "ejblocal:".


//this will be flagged
new InitialContext().lookup("ejblocal:" + getEJBName());

The rule also flags JNDI names that do not use one of the namespaces listed above for the binding-name attribute value in the <ejb-ref> element in the ibm-ejb-jar-bnd.xml and ibm-web-bnd.xml files.


//this binding will not be flagged
<ejb-ref name="TestBean" binding-name="java:global/TestApp/TestModule/TestBean!test.TestRemoteInterface">

The rule also flags JNDI names that do not use one of the namespaces listed above for the jndiName attribute value in the <ejbRefBindings> element in the ibm-ejb-jar-bnd.xmi and ibm-web-bnd.xmi files.


//this JNDI name will be flagged
<ejbRefBindings jndiName="java:myFolder/">

For more information on using Enterprise Java Beans 2.x in Liberty, see Using enterprise JavaBeans with remote interfaces on Liberty.