Use WebSphere bindings to define EJB reference names

The WebLogic-specific deployment descriptors, weblogic.xml or weblogic-ejb-jar.xml may contain EJB references. These references map an EJB reference to its JNDI name (see following example). In order for the references to work properly on WebSphere traditional and Liberty, information must be moved to the WebSphere Application Server bindings file.

This rule flags EJB references found in weblogic.xml and weblogic-ejb-jar.xml. An automated fix will be provided for this rule takes the EJB reference information defined in the WebLogic-specific deployment descriptors and migrates it to the standard deployment descriptors and the WebSphere Application Server bindings file.

For example, consider a WebLogic web module which references the EJB MyBean. The reference is defined in the following weblogic.xml example:

weblogic.xml constructs

<weblogic-web-app>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>MyBean</ejb-ref-name>
<jndi-name>ejb/MyBean</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-web-app>



The JNDI name is added to the bindings file. It references the existing reference defined in web.xml.

Similarly, when an EJB reference is found in an EJB project, information is moved from the weblogic-ejb-jar.xml file to the EJB bindings file. The following example shows MyBean2 referencing MyBean from weblogic-ejb-jar.xml.


weblogic-ejb-jar.xml constructs

<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>MyBean2</ejb-name>
<jndi-name>ejb/MyBean2</jndi-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>MyBean</ejb-ref-name>
<jndi-name>ejb/MyBean</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>




The JNDI name is added to the bindings file.