首页 > 数据库技术 > 详细

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

时间:2019-10-23 14:13:54      阅读:115      评论:0      收藏:0      [点我收藏+]

   这个错误的原因是没有项目使用到了Tomcat中配置的数据源(但是你本地没有配置),关于什么是JNDI看这篇文章就够了®

  今天导入一个项目(比较老的),在本地运行时报错;

       

Cannot resolve reference to bean apwhatsupDS1 while setting bean property dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name apwhatsupDS1 defined in class path resource [applicationContext-report-ap.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

  重点是这个地方的错误:Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

  找到这个注入bean的地方;

技术分享图片

 

  这个问题只需要在Tomcat中配置JNDI数据源即可;

  看下面的步骤即可:

    1.在IDE开发工具里面引用的tomcat中去配置server.xml和content.xml文件

技术分享图片

 

 

    2.在server.xml中配置Resouce

 

 

技术分享图片

 

    3.在content.xml中配置技术分享图片

 

 

 

 

打赏

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

原文:https://www.cnblogs.com/gqzdev/p/db-jndi.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!