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

这个错误的原因是没有项目使用到了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中配置

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值