【项目部署】SpringBoot 项目编译部署问题

来源:23-1 课程总结

慕仙8513709

8天前

执行java -jar -Dspring.config.location=application-prod.properties job-api.jar命令后,在postman发送get请求报错:
{
“code”: 600,
“msg”: “nested exception is org.apache.ibatis.exceptions.PersistenceException: \n### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure\n\nThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.\n### The error may exist in class path resource [mapper/JobCategoryMapper.xml]\n### The error may involve com.example.job.mapper.JobCategoryMapper.allJobCategory\n### The error occurred while executing a query\n### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure\n\nThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.”,
“data”: null
}
数据库能连接,名称密码都测试过了,没问题

写回答

1回答

彭彭老师

6天前

检查一下配置文件中的数据库地址、用户名、密码是否正确,看错误信息是数据库连接失败了

0
2
慕仙8513709
感谢老师指点,我反复确认确实是数据库密码问题,现在问题已解决
6天前
共2条回复

Java零基础入门与实战

Java零基础入门与实战 多场景|多案例|全栈项目

339 学习 · 247 问题

查看课程