在基于WAS开发的系统中,SystemOut.log中经常出现如下信息:
如何解决这个警告:
[3/29/06 14:10:12:015 CST] 00000025 ConnectionFac W J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/whaty. The following default values are used: [Resource-ref settings]
res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
loginConfigurationName: null
loginConfigProperties: null
[Other attributes]
res-resolution-control: 999 (undefined)
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)
这是怎么回事呢?
其实这个警告信息并不影响应用的运行,主要是开发人员没有严格遵守J2EE规范引起的。通过如下方法来解决:
1,在程序中这样改lookup的参数:
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/ecommDB");
2,web.xml中包含类似信息:
<resource-ref id="ResourceRef_1089625098453">
<res-ref-name>jdbc/ecommDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
3,ibm-web-bnd.xmi文件增加类似语句:
<resRefBindings xmi:id="ResourceRefBinding_1089625098453" jndiName="jdbc/ecommDB">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1089625098453"/>
</resRefBindings>