Name jdbc is not bound in this context
来源:互联网 发布:尤里复仇 mod 知乎 编辑:程序博客网 时间:2024/06/03 11:07
"javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"
这个错误网络上一大堆。大概知道这是应为WEB-INF里的web.xml文件中没有以下配置或者是配置错误:
<resource-ref>
首先,我们在Tomcat安装文件中找到 conf/context文件并打开, 在这里,我以我用的Oracle数据库
来配置。
而在WEB-INF文件下的 web.xml中,我们配置
<resource-ref></resource-ref>
例如:
在Tomcat中配置的name="jdbc/oracleds" ,而在 web.xml文件中配置的name="jdbc/oracle"都会引起
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
认真的看了自己的context.xml和web.xml中的配置,觉得它们正确无误。而错误依然不能消除,那么你看这篇文章就对了,也许它会是你的指路明灯。
你看一下自己的JSP文件,是否有这样一句:
DataSource ds=(DataSource)initContext.lookup("java:/comp/env/jdbc/xinabai");
请将它改为:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/xinbai");
虽然无数本书和帖子告诉你,这两个方法相同。但是,很明显,前一种会在某种情况下产生Name jdbc is not bound in this Context的错误。
具体原因我不清楚,希望知道原因的高人可以告知一二。
- Name jdbc is not bound in this Context
- Name jdbc is not bound in this context
- 数据源没发现! Name [jdbc/mysql5] is not bound in this Context. Unable to find [jdbc].
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context错误待解决中
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- 应对Name jdbc is not bound in this Context-----------我的一个总结
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- 解决javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- Tomcat配置连接池 异常:javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- 关于出现Name jdbc is not bound in this Context错误的解决
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- javax.naming.NameNotFoundException: Name [jdbc/lappJDBC] is not bound in this Context. Unable to fi
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
- Name java:comp is not bound in this Context解决办法
- Name java:comp is not bound in this Context
- name jndi is not bound in this context
- tomcat5.0 下JNDI javax.naming.NameNotFoundException: Name jdbc is not bound in this Context 问题的解决
- js 一句代码string转date
- [CTS Verifier]Notification Package Priority Test
- 去掉android中的标题显示
- oracle11g中ASM磁盘组的mount
- DSOframer 微软官方API的查阅方法
- Name jdbc is not bound in this context
- ClassLoader, JavaAgent, Aspectj Weaving一站式扫盲帖
- 托业考试要准备什么资料【zhasite】
- Spark学习笔记之-Spark Standalone(环境搭建)
- Java内存区域、内存溢出异常和对象创建、布局、访问全过程
- 生命周期
- 类与类之间的几种关系
- 简单程序
- Maven零散笔记——常用配置