zoukankan      html  css  js  c++  java
  • Springboot提示数据库连接问题Connection is not available

    2019-05-29 11:19:51.824 WARN 854 --- [io-8080-exec-10] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: null
    
    2019-05-29 11:19:51.825 ERROR 854 --- [io-8080-exec-10] o.h.engine.jdbc.spi.SqlExceptionHelper : HikariPool-1 - Connection is not available, request timed out after 30004ms.
    2019-05-29 11:19:51.844 ERROR 854 --- [io-8080-exec-10] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/aa/bb] due to exception [Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection]
    
    org.springframework.dao.DataAccessResourceFailureException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:238) ~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:225) ~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]

    百度后,尝试了很多方法,包括修改数据库的超时时间:

    mysql> set global wait_timeout=28800;
    Query OK, 0 rows affected
    mysql> show global variables like 'wait_timeout';

    包括设置参数:

    spring.datasource.hikari.read-only=false
    spring.datasource.hikari.connection-timeout=60000
    spring.datasource.hikari.idle-timeout=60000
    spring.datasource.hikari.validation-timeout=3000
    spring.datasource.hikari.max-lifetime=60000
    spring.datasource.hikari.login-timeout=5
    spring.datasource.hikari.maximum-pool-size=60
    spring.datasource.hikari.minimum-idle=10

    多种方法后,发现可能还是需要在pom.xml文件中添加参数配置可能解决此问题。

  • 相关阅读:
    springboot jpa 的使用
    《 mysiteforme 》 学习之wangEditor的使用
    《 mysiteforme 》 学习之layui table 的使用
    《 mysiteforme 》 学习之数据字典的使用
    Shiro + redis + 登录 + 记住我 + 验证码 + 登出(mysiteforme)
    spring boot 使用kindeditor上传传照片到nginx
    easypoi excel 文件导入导出
    猜年龄
    Kth number
    乌龟棋
  • 原文地址:https://www.cnblogs.com/wozijisun/p/10949415.html
Copyright © 2011-2022 走看看