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

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

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

查了下解决方案:在项目的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>

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

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

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

相关文章:

  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2021-12-11
  • 2021-10-14
猜你喜欢
  • 2022-01-07
  • 2021-09-23
  • 2022-01-04
  • 2021-07-01
  • 2021-09-20
  • 2021-09-13
  • 2021-12-30
相关资源
相似解决方案