获取连接时服务器的连接池关闭

发布于 2025-01-19 15:19:43 字数 1755 浏览 5 评论 0原文

我们使用Spring Data Neo4J在春季启动应用程序中遇到了很多错误,这是由此错误引起的:

org.neo4j.driver.exceptions.ServiceUnavailableException: Connection pool for server server-url.example.com:xxxx is closed while acquiring a connection.

有人知道此错误来自何处吗?我们必须在数据库服务器端还是应用程序端上调整池?

我们使用的是Neo4J 4.0.11和Spring-Data-Neo4J 6.1.1(在Spring-Boot-Starter-Data-neo4J 2.5.5中)。连接是用螺栓协议进行的。

编辑:

以下是我们的配置上的其他信息:

application.yml:

server:
  port: 9080
  error.include-message: always

management:
  endpoint:
    health:
      group:
        readiness:
          include: neo4j
        liveness:
          include: neo4j
logging.level:
  root: WARN
  org.springframework: INFO
  io.package.directions: INFO

spring:
  application.name: directions
  cache:
    cache-names: nodes, records
    caffeine.spec: maximumSize=1000
  config.location: classpath:/config/
  profiles.active: prod
  jmx.enabled: false
  jackson.serialization:
    FAIL_ON_EMPTY_BEANS: false
    WRITE_DATES_AS_TIMESTAMPS: true
    WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS: false

spring.neo4j:
  uri: ${NEO4J_URL}
  authentication:
    username: ${NEO4J_USERNAME}
    password: ${NEO4J_PASSWORD}

mail:
  api: "http://${MAIL_SERVICE_HOST:mail}:${MAIL_SERVICE_PORT:9000}"

我们使用螺栓协议连接到另一个kubernetes Pod。

这是我们相当简单的交易管理BEAN:

@Configuration
@EnableTransactionManagement
public class TxConfig {
    final Driver driver;

    public TxConfig(Driver driver) {
        this.driver = driver;
    }

    @Bean
    public ReactiveTransactionManager reactiveTransactionManager() {
        return new ReactiveNeo4jTransactionManager(driver);
    }
}

We are getting a lot of errors in our Spring boot app using Spring data Neo4j, caused by this error:

org.neo4j.driver.exceptions.ServiceUnavailableException: Connection pool for server server-url.example.com:xxxx is closed while acquiring a connection.

Does anyone have an idea of where this error comes from ? Do we have to tweak the pools on the database server side or on application side ?

We are using Neo4j 4.0.11 and spring-data-neo4j 6.1.1 (in spring-boot-starter-data-neo4j 2.5.0). The connection is made with bolt protocol.

EDIT:

Here are additional infos on our configuration:

application.yml:

server:
  port: 9080
  error.include-message: always

management:
  endpoint:
    health:
      group:
        readiness:
          include: neo4j
        liveness:
          include: neo4j
logging.level:
  root: WARN
  org.springframework: INFO
  io.package.directions: INFO

spring:
  application.name: directions
  cache:
    cache-names: nodes, records
    caffeine.spec: maximumSize=1000
  config.location: classpath:/config/
  profiles.active: prod
  jmx.enabled: false
  jackson.serialization:
    FAIL_ON_EMPTY_BEANS: false
    WRITE_DATES_AS_TIMESTAMPS: true
    WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS: false

spring.neo4j:
  uri: ${NEO4J_URL}
  authentication:
    username: ${NEO4J_USERNAME}
    password: ${NEO4J_PASSWORD}

mail:
  api: "http://${MAIL_SERVICE_HOST:mail}:${MAIL_SERVICE_PORT:9000}"

We connect to another kubernetes pod using bolt protocol.

Here is our fairly simple transaction management bean:

@Configuration
@EnableTransactionManagement
public class TxConfig {
    final Driver driver;

    public TxConfig(Driver driver) {
        this.driver = driver;
    }

    @Bean
    public ReactiveTransactionManager reactiveTransactionManager() {
        return new ReactiveNeo4jTransactionManager(driver);
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文