spring-boot - com.zaxxer.hikari.pool.HikariPool$PoolInitializationException:池初始化期间出现异常:springHikariCP - 连接不可用
问题描述
你能帮忙吗:
我启动了我的应用程序,但它在几秒钟后关闭,出现以下错误:
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.
解决方案
如果您不需要使用 HikariCP,您可以检查您的 POM,如果它已经定义,请考虑将其删除。
您还可以确保使用以下依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
假设您使用的是 xml 配置,您可以确保正确设置数据源:
推荐阅读
- angular - How to unit test just one function, without browser, on Angular
- react-native - React native: Is it possible to set initial position to SectionList without using scrollToLocation
- python - How to use thread in asyncio?
- python - 如何连接一个 Dataframe 列的值?
- amazon-web-services - 从 S3 存储桶中删除空文件
- vue.js - 静态 JS 文件未在 nuxtJS 的动态页面上加载
- mysql - 谷歌云平台 MYSQL 8 中的 lower_case_table_names
- hadoop - Hive 查询派生列并找到派生列的总数
- postgresql - 用适当的连接替换子查询
- php - 带有 SQL 的 PHP 邮件程序在特定行上发送电子邮件