http://localhost:8899/v1/getUserCount 访问报如下错误

来源:11-2 使用mybatis+SpringBoot完成第一个查询demo

慕粉1728312458

2021-05-25

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue May 25 18:22:11 CST 2021
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: 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. ### The error may exist in file [D:\D\XiaoBao\Chapter11\target\classes\mapper\mysql.xml] ### The error may involve com.course.getUserCount ### The error occurred while executing a query ### Cause: 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.

写回答

1回答

大周

2021-05-31

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection

这个意思是说数据库连接被拒绝了。 检查你数据库的配置

0
1
慕粉1728312458
非常感谢!
2021-06-01
共1条回复

Java接口自动化测试实战,搞定理论基础+典型应用场景

打破传统测试用例设计方法,搞懂基于TestNG的接口自动化测试技术

2087 学习 · 920 问题

查看课程