【项目部署】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回答
-
检查一下配置文件中的数据库地址、用户名、密码是否正确,看错误信息是数据库连接失败了
026天前
相似问题
回答 1