我在WebSphere中定义了一个名为'jdbc/dataSource1'的JDBC数据源。
在我的基于Spring的应用程序中,我想使用jndi查找获取数据源,但是使用其他名称,如'jdbc/dataSource2'。
为了实现这一点,我创建IBM的Web-bnd.xml文件,其中i的定义的连接如下:数据源自动绑定
<resource-ref binding-name="jdbc/dataSource2" name="jdbc/dataSource1"/>
此外,我在web.xml文件中定义的数据源如下:
<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>
该解决方案仅在使用IBM Web Console进行部署时起作用。当我使用wsadmin工具尝试部署使用自定义Jython脚本,我得到以下错误:
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"
在wsadmin脚本来我使用AdminApp.install(path_to_ear,期权),其中选择变量只包含关于虚拟主机的选择映射。
所以问题是我该怎么做,所以WebSphere将从ibm-web-bnd.xml文件中获取数据源映射选项?
http://stackoverflow.com/questions/ 19096482/binding-container-managed-authentication-alias-with-datasource-using-jython-scri – 2014-08-30 14:23:40