[07-12-4 11:17:51:921 CST] 0000001a ConnectionFac W J2CA0294W: 不推荐使用资源 jdbc/oracleDS 的直接 JNDI 查找。使用下列缺省值:[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)
res ref or CMP bean name: null
Database pool properties: null
primeID: 0
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)
##########################################################################################
解决方法:WebSphere Application Server 6.1.0.0 下:
\WEB-INF\ibm-web-bnd.xmi文件
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.ejs.models.base.bindings.webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1196672221187" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#WebApp_1166165893137"/>
<resRefBindings xmi:id="ResourceRefBinding_2" jndiName="jdbc/oracleDS">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_2"/>
</resRefBindings>
</com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding>
\WEB-INF\web.xml文件 资源引用
<resource-ref id="ResourceRef_2">
<res-ref-name>jdbc/sxidc</res-ref-name>
<res-type>java.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
以上配置将配置在websphere中的数据源 jdbc/oracleDS 映射为 jdbc/sxidc的间接名称。数据源的获取用如下的jndi java:comp/env/jdbc/sxidc
如代码“InitialContext initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("");
ds = (DataSource) envCtx.lookup("java:comp/env/jdbc/sxidc");
connection = ds.getConnection();”
或如hibernate配置文件中
<session-factory>
<property name="hibernate.connection.datasource">
java:comp/env/jdbc/sxidc
</property>
........................
#######################################
较早的版本中 j2ee1.3 ....
ibm-web-bnd.xml 中有这段内容,这个将会再部署到 WAS 时自动被管理控制台读出来并创建资源配置,跟我们手工创建一个数据源一样。
<?xml version="1.0" encoding="UTF-8"?>
<webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#WebApp"/>
<resRefBindings xmi:id="ResourceRefBinding_1129470735234" jndiName="jdbc/xa/sample">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1129470735234"/>
</resRefBindings>
</webappbnd:WebAppBinding>
下面这个是 web.xml 中的一段内容,这里 id 和上面的 ref 对应,这样就能映射一个 全局 资源到一个 web容器组件内的资源上来。 资源是配置在服务器的全局资源池中他的 JNDI 为 jdbc/xa/sample, 然后映射到 web 容器这个组件中名字为jdbc/sample.我用 ctx.lookup("java:comp/env/jdbc/sample") 来访问,因为你 ctx.lookup("java:comp/env/xxxx") 时就是在web容器内,在ejb 中调用 ctx.lookup("java:comp/env/xxxx") 则是在 ejb 容器内的,如果没有配置引用你可能找不到资源,或者导致一个上面的警告, Tomcat 5 中没有 ibm-web-bnd.xml ,但是 Tomcat 5 能在一个 context 的配置中添加一个 resource-link 来完成这个映射,方法是在 /META-INF/ 中的context.xml (如果没有这个文件,可以从 %CATALINA_HOME%/conf/Catalina/localhost/manager.xml 拷贝一个,改一下内容,并改名为 context.xml ),在其中添加一个resource-link . 具体操作也可以 jakarta.apache.org/tomcat 下载一个 jakarta-tomcat-admin-x.xx.zip 并解压,用它来完成配置。
<web-app>
<!-- ... 其他内容省略 -->
<resource-ref id="ResourceRef_1129470735234">
<res-ref-name>jdbc/sample</res-ref-name>
<res-type>java.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
分享到:
相关推荐
以oracle9i数据源制作的模板jndi.cpt为例来说明如何在FineReport中的Websphere配置JNDI连接,并进行详细演示。
在创建数据源后,在java中使用数据源时tomca和was的引用方法是不同的
NULL 博文链接:https://chenhua-1984.iteye.com/blog/1543415
websphere安装布署,一全套的内容都有,图文全过程。
webSphere发应用资源记录表,发布大型应用先记录,后配置webSphere
websphere常见问题及解决办法 如 Error 404: SRVE0190E JSPG0049E
Websphere6.1 安装 配置 DataSource JDBC JNDI ORACLE
WebSphere7使用手册 WebSphere7使用手册
WebSphere安装后,修改hostname 配置文件 1.1 WebSphere配置文件 1.2 操作系统配置文件 2.1 检查初始配置 2.2.3 对AdminTask 对象调用 changeHostName命令 2.2.4 保存节点主机名的配置修改
解决 WebSphere 不支持 JDK 新特性的问题 在 WebSphere Application Server V6.1 中,如果 JSP 中嵌入的代码包含 JDK 5.0 的特性,编译的时候会出错。这是因为 WAS6.1 采用 JDK5.0,因此需要设置相应的 JSP 引擎...
IBM WebSphere Portal 解决方案
WebSphere配置JNDI方法(以配置Oracle数据库为例)【附图】
J2EE应用中一般采用properties或者Web.xml存储系统的一些配置信息,这些方法不可避免地需要修改文件,而采用WAS中的资源环境提供程序可以在WAS控制台直接修改配置属性值,另外多个应用可以共享同一个配置属性。
websphere commerce的使用即websphere commerce图解.在网上扒了半天才找到的稀品啊!IBM创建商品店铺(websphere commerce).pdf 一些其他的相关资料: ...
Websphere过有效期后,我们要是重装那很困难,也不一定成功,但也有便捷的解决办法,文档中列举了2中方法, 一定不会让您失望!
webSphere指南webSphere指南webSphere指南webSphere指南webSphere指南
WebSphere Application Server 故障诊断的资源以及相关工具的介绍
websphere设计
在Websphere Application Server 经常会出现乱码,有时候可以在项目中去设置,但有时候也是Websphere 造成的,所以需要你手动去更改Websphere 的设置。
WebSphere