0
点赞
收藏
分享

微信扫一扫

为什么配置文件的URL路径编译成“http://www.example.com“

无愠色 2022-04-04 阅读 55
webviewjava

报错信息

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'http://www.example.com

database.properties文件写的

url=jdbc:mysql://localhost:3306/forum?useUnicode=true&characterEncoding=utf-8

后来才晓得在maven配置中有 这么一段话

 <name>forum Maven Webapp</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

这就导致URL在编译时会被覆盖掉重新编译

所以解决问题的方法就是在database.properties文件中URL的名称随便换掉就可以了,只要不是叫url都可以。。。。。。

对应的

<property name="url" value="${改写后的url名称}"></property>

这样避免了编译覆盖问题就解决了

举报

相关推荐

0 条评论