Use WebSphere bindings to define resource environment reference JNDI names

WebLogic-specific deployment descriptors, weblogic.xml or weblogic-ejb-jar.xml, might contain resource environment description elements. These elements map resource environment references to a JNDI name. This rule detects the WebLogic resource environment reference JNDI names. A quick fix is available in the source scanner. The quick fix migrates the JNDI name to the WebSphere Application Server bindings file.

Example of weblogic.xml constructs detected:

<weblogic-web-app>
...
<resource-env-description>
<res-env-ref-name>jms/myQueue</res-env-ref-name>
<jndi-name>jndi/myQueue</jndi-name>
</resource-env-description>
...
</weblogic-web-app>

The corresponding resource environment reference must be available in the corresponding web.xml file. For this example, the web.xml file must contain a resource-env-ref named jms/myQueue.

<web-app>
...
<resource-env-ref>
<resource-env-ref-name>jms/myQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
...
</web-app>

The quick fix saves the JNDI name in the bindings file, and the reference is correlated to a <resource-env-ref> element in the web.xml file.

Similarly for weblogic-ejb-jar.xml constructs, <resource-env-description> elements that correspond to <resource-env-ref> elements for the specified EJB, the JNDI name will be saved in WebSphere traditional or Liberty bindings.

<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>MyBean</ejb-name>
...
<reference-descriptor>
...
<resource-env-description>
<res-env-ref-name>jms/myQueue</res-env-ref-name>
<jndi-name>jndi/myQueue</jndi-name>
</resource-env-description
</reference-descriptor>
...
</weblogic-enterprise-bean>
</weblogic-ejb-jar>