Spring Boot MyBatis 数据库连接超时错误: HikariPool-1 - Connection is not available, request timed out 解决方法
"Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: 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 java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 371809ms.\n### The error may exist in fun/ysn/sixjava/mapper/PeriodsDetailsMapper.java (best guess)\n### The error may involve fun.ysn.sixjava.mapper.PeriodsDetailsMapper.selectCount\n### The error occurred while executing a query\n### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 371809ms.] with root cause\n\njava.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 371809ms.\n\n中文回答\n内容:这个错误是由于在处理请求时,无法获取到数据库连接导致的。具体错误信息是HikariPool-1 - Connection is not available, request timed out after 371809ms。\n\n这个错误可能的原因有:\n1. 数据库连接池中的连接不足或已经被占用,无法获取到可用的连接。\n2. 数据库连接超时,请求等待连接的时间超过了限制。\n\n解决这个问题的方法有:\n1. 检查数据库连接池的配置,确保连接池中有足够的连接供应用程序使用。\n2. 调整连接超时时间,增加等待连接的时间限制。\n3. 检查数据库服务器的状态,确保数据库服务器正常运行并且能够提供连接。\n\n如果以上方法都无法解决问题,可能需要进一步检查应用程序的代码逻辑和数据库配置,以确定是否存在其他问题。"
原文地址: https://www.cveoy.top/t/topic/p40m 著作权归作者所有。请勿转载和采集!