Error creating bean with name 'dataSource' defined in file [WEB_INF\classes\spring\applicationContex
在对一个web项目研究的时候,只有一个war包,然后进行了反编译导入到 Eclipse中,部署运行时,遇到了如下问题:
主要报错的地方:
Error creating bean with name 'dataSource' defined in file [WEB_INF\classes\spring\applicationContext.xml]
Name [jdbc/testqry] is not bound in this Context. Unable to find [jdbc].网上查询了一下,说是tomcat数据源配置的问题,然后试了一下,果然是因为数据源配置导致的。
1、确认数据库的配置信息都是正确的(URL、username、 password等)
2、 查看服务器对于的Service配置信息:
修改这里面的两个配置文件:
context添加:
在Context 节点下面添加
<ResourceLink global="jdbc/testqry" name="jdbc/testqry" type="javax.sql.DataSource"/>
Service中:
<Resource name="jdbc/testqry" auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.49.181:1521:rac"
maxActive="50"
maxldle="10"
maxWait="5000"
username="testqry"
password="testqry" />