当前位置:   article > 正文

通用mapper打jar包报错Failed to obtain JDBC Connection;nested exception is com.mysql.jdbc.exceptions.jdbc4._failed to obtain jdbc connection; nested exception

failed to obtain jdbc connection; nested exception is com.mysql.cj.jdbc.exce

最近自己搭建springboot的demo案例,正准备将案例打成jar包的时候提示报错

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server

根据错误提示和自己尝试解决方式如下:

因引入通用mapper,在pom.xml中就不再引用jdbc和mybatis的依赖包,但是自己打jar包的时候mysql的数据库连接服务未启动,所以连接jdbc失败,所以重新开启mysql连接即可解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/976662
推荐阅读
相关标签
  

闽ICP备14008679号