properties配置文件中空格引发的血案
2016-08-18 15:30
218 查看
今天翻起以前空闲时候做的项目,刚起服务的时候就遇到了问题,直接报连不到数据库,
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is
因为是本地的数据库,在本地dos下是可以连接上的
![](https://img-blog.csdn.net/20160818154054938?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
检查JDBC的properties 配置文件,URL参数配的确实没错,找了半天,又仔细看了一下报错原因..恍然大悟..原来多了一个空格
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Incorrect database name 'fade
')
原来spring工厂启动,加载外部properties文件的时候如果有空格会直接读取成空串,引以为戒
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is
因为是本地的数据库,在本地dos下是可以连接上的
检查JDBC的properties 配置文件,URL参数配的确实没错,找了半天,又仔细看了一下报错原因..恍然大悟..原来多了一个空格
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Incorrect database name 'fade
')
原来spring工厂启动,加载外部properties文件的时候如果有空格会直接读取成空串,引以为戒
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is
相关文章推荐
- .properties 配置文件 加空格
- 在properties配置文件中添加空格
- 谈Java Properties配置文件, 是J2EE容器的命令行绑定, 还是使用Deploy自适应的绑定?
- Java font.properties 配置文件(中文/翻译中。。。)
- Log4J 配置文件 指定类 properties
- struts2的struts.properties配置文件详解
- struts.properties配置文件详解
- Java中封装配置文件(1)-使用Properties
- struts2的struts.properties配置文件详解(转)
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- Properties读取配置文件
- 利用Properties讀取配置文件
- 如何用properties文件而不用XML配置Bean
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- Java中封装配置文件(1)-使用Properties (转)
- struts2的struts.properties配置文件详解
- struts2的struts.properties配置文件详解
- Java Properties 类读取配置文件信息