Issue with resource-ref om web.xml – Failed to process bindings for metadata

web.xmlwebsphere

I have resource-ref to the datasource in my deployment descriptor.

web.xml

    <resource-ref>
           <description></description>
           <res-ref-name>jdbc/myAppDS</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Application</res-auth>
           <res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>

When I try to publish the ear in my local RAD – websphere environment, I'm getting below exception.

Caused by: com.ibm.wsspi.injectionengine.InjectionException: CWNEN0044E: A resource reference binding could not be found for the following resource references [jdbc/myAppDS], defined for the MyApp Web Application component.
at com.ibm.wsspi.injectionengine.InjectionProcessor.collectInjectionNBindingData(InjectionProcessor.java:1042)
at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:516)
… 77 more

datasource myAppDS is registered with the Websphere and test connection is also successful. Is there any reason why the war is unable to find the resource?

Best Answer

I solve the problem adding the datasource in this file

/WebContent/WEB-INF/ibm-web-bnd.xmi

  <resRefBindings xmi:id="rr_jdbc.dataSourceName_jdbc.dataSourceName" jndiName="jdbc.dataSourceName">
    <bindingResourceRef href="WEB-INF/web.xml#rr_jdbc.dataSourceName"/>
  </resRefBindings> 
Related Topic