码迷,mamicode.com
首页 > 编程语言 > 详细

javax.naming.NameNotFoundException:Name[ XXX] is not bound in this context.

时间:2014-11-08 22:00:52      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   io   ar   java   文件   数据   div   

在用局部数据源去连数据库的时候,在本地的项目中,都是可以的,可是一部署到服务器上,就报错了。

报的错误是:javax.naming.NameNotFoundException:Name[ XXX] is not bound in this context.

bubuko.com,布布扣

查了下解决方案:在项目的web.xml中加入下面的代码

 <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>zjut_echarts</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

加入以后呢,这个错误是消失了,但是又来了一个新的错误。

bubuko.com,布布扣

怎么办,好呢?目前的解决方案是:C:\apache-tomcat-7.0.37\conf目录下面的context.xml删掉,把我们项目中的META-INF目录下的context.xml文件复制到C:\apache-tomcat-7.0.37\conf目录下

javax.naming.NameNotFoundException:Name[ XXX] is not bound in this context.

标签:des   blog   http   io   ar   java   文件   数据   div   

原文地址:http://www.cnblogs.com/michaeljunlove/p/4084051.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!