I have a JDBC datasource defined in WebSphere named 'jdbc/dataSource1'.
In my application based on Spring i want to obtain the datasource using jndi lookup, but by another name, like 'jdbc/dataSource2'.
To achieve this i created ibm-web-bnd.xml file, in which i defined the linkage as follows:
<resource-ref binding-name="jdbc/dataSource2" name="jdbc/dataSource1"/>
Also i defined the datasource in the web.xml file as follows:
<resource-ref>
<description>some awesome datasource</description>
<res-ref-name>jdbc/dataSource2</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
The solution works only while deploying using IBM Web Console. When i try to deploy it using custom jython script using wsadmin tool, i get the following error:
ADMA0007E: A Validation error occurred in task Mapping resource references to re
sources. The Java Naming and Directory Interface (JNDI) name is not specified f
or reference binding jdbc/dataSource2 in module <application_name>.war"
In wsadmin script i use AdminApp.install(path_to_ear, options), where options variable contain only options regarding virtual hosts mapping.
So the question is what should i do, so the WebSphere will get the datasource mapping options from ibm-web-bnd.xml file?