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

最近自己搭建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连接即可解决

你可能感兴趣的:(java,错误集锦,java)