Failed to invoke the method getXXX in the service
其中可能包括的错误 pojo类没有实现Serializable 数据库密码错误 数据库驱动版本错误
这里最头疼的是数据库驱动问题, 排查很久都找不出问题,一般就是这个导致的。能搞死人~
查看mysql版本
注意:如果你的版本号是8.0以上的版本,你的数据库连接配置文件db.properties中的数据库地址需要修改为com.mysql.cj.jdbc.Driver
,不能用jdbc.driver=com.mysql.jdbc.Driver
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/xxx(此处填你的数据库名)?serverTimezone=UTC&characterEncoding=utf-8&useSSL=false
jdbc.username=root
jdbc.password=***(数据库密码)
其实和上面是一个问题,mysql8.0的jdbc版本也要调整
{"code":1,"message":"org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: \r\n### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: com.mysql.cj.jdbc.Driver\r\n### The error may exist in com/qingcheng/dao/BrandMapper.java (best guess)\r\n### The error may involve com.qingcheng.dao.BrandMapper.selectAll\r\n### The error occurred while
<!-- mysql 5.x驱动包依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<!-- mysql8.x驱动包依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
版权属于:dingzhenhua
本文链接:https://cloud.tencent.com/developer/article/2019339
转载时须注明出处及本声明
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有