Could not resolve placeholder 'master.jdbc.url' in string value "${master.jdbc.url}"

来源:互联网 发布:input js让失去焦点 编辑:程序博客网 时间:2024/05/21 08:55
 org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'masterDataSource' defined in file [C:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\xinghe-mycenter-web\WEB-INF\classes\spring\applicationContext-dbpool-c3p0.xml]: Could not resolve placeholder 'master.jdbc.url' in string value "${master.jdbc.url}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'master.jdbc.url' in string value "${master.jdbc.url}"

很明显,项目中使用了c3p0连接池。
而出现此错误的原因是缺少配置文件,严格的说是C3P0从配置文件中找不到名称为“master.jdbc.url”的配置项。
解决办法:
如下图,这是一个Maven Web项目,如果没有对应的目录或文件就创建它。

jdbc.properties文件内容:其实你可以叫其它的名称,但扩展名是不可改变的。
# dataSource relatedjdbc.driver.class=com.mysql.jdbc.Drivermaster.jdbc.url=jdbc:mysql://192.168.1.127:3306/testcs_dn?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&relaxAutoCommit=true&useServerPreparedStmts=truemaster.jdbc.username=abcdmaster.jdbc.password=**********
重新发布:最好是Clean,Publish通常也没问题,遇到人品不好的情况就不好说了……


2 1
原创粉丝点击