Spring Boot - JPADataSourcePool-121 - 池初始化期间出现异常

问题描述 投票:0回答:1

在构建步骤中构建詹金斯管道期间,我遇到此错误:

2024-11-25 11:55:52.901+0100 [@project.artifactId@] ERROR [main] [//] [c.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException] - JPADataSourcePool-121 - Exception during pool initialization.
com.edb.util.PSQLException: Connection attempt failed.
    at com.edb.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:393)
    at com.edb.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
    at com.edb.jdbc.PgConnection.<init>(PgConnection.java:226)
    at com.edb.Driver.makeConnection(Driver.java:483)
    at com.edb.Driver.connect(Driver.java:276)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)

Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
    at java.net.Socket.connect(Socket.java:606)
    at com.edb.core.PGStream.createSocket(PGStream.java:234)
    at com.edb.core.PGStream.<init>(PGStream.java:97)
    at com.edb.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:95)
    at com.edb.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:240)

我在 application.yml 中看到的一些信息(值在 pod 容器的环境变量中定义):

connectors:
  jpaConfigurations:
    connection:
      url: ${DSPOSTGRESQL_URL:}
      driver-class-name: com.edb.Driver
      username: ${DSPOSTGRESQL_USERNAME:}
      password: ${DSPOSTGRESQL_PASSWORD:}
      connectionPoolSize: ${DSPOSTGRESQL_CONNECTION_POOL_SIZE}
      timeout: 6000
      hibernateDialect: org.hibernate.dialect.PostgreSQLDialect
      hbm2ddl: none
      show-sql: true

我尝试在本地构建/运行该应用程序,它运行良好,最近 pom 中唯一发生变化的是由于我的公司政策,我必须使用的 2 个库的主要版本。

java spring-boot jpa jenkins-pipeline psql
1个回答
0
投票

您似乎无法连接到数据库。 也许您可以检查

$DSPOSTGRESQL_URL
的值是否在部署中正确设置?

© www.soinside.com 2019 - 2024. All rights reserved.