com.zaxxer.hikari.pool.HikariPool $ PoolInitializationException:池初始化期间的异常:springHikariCP-连接不可用

时间:2018-09-21 07:50:13

标签: spring-boot hikaricp spring-framework-beans

您能帮忙吗?

我启动了我的应用程序,但在出现以下几秒钟的错误后它正在关闭:

2018-09-21 17:34:59,500  INFO | main | com.zaxxer.hikari.HikariDataSource                        93 | springHikariCP - is starting. | 
        2018-09-21 17:35:29,535  INFO | main | com.zaxxer.hikari.pool.HikariPool                        213 | springHikariCP - is closing down. | 
        2018-09-21 17:35:29,855  WARN | main | o.s.context.support.ClassPathXmlApplicationContext       551 | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appEntityManagerFactory' defined in class path resource [META-INF/spring/app.repositories.xml]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Exception during pool initialization: springHikariCP - Connection is not available, request timed out after 30002ms. | 
        2018-09-21 17:35:29,870 ERROR | main | com.my.jos.jmx.Driver                            72 | CRITICAL ERROR: Error encountered starting application. | 
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appEntityManagerFactory' defined in class path resource [META-INF/spring/app.repositories.xml]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Exception during pool initialization: springHikariCP - Connection is not available, request timed out after 30002ms.

1 个答案:

答案 0 :(得分:0)

如果您不需要使用HikariCP,则可以检查POM并考虑将其删除(如果已定义)。

您还可以确保使用以下依赖项:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

假设您使用的是xml配置,则可以确保正确设置数据源:

  

How to Define a MySql datasource bean via XML in Spring