Could not resolve placeholder 'master.jdbc.url' in string value "${master.jdbc.url}",couldnotresolve
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通常也沒問題,遇到人品不好的情況就不好說了……