繁体   English   中英

无法打开JPA EntityManager

[英]Could not open JPA EntityManager

我已经有一段时间这个错误了,我不知道是什么原因引起的。

问题是它仅在生产中发生。 我已将应用程序部署到由Beanstalk管理的AWS EC2容器。 该错误每隔几个小时显示一次; 不知道多少。

在网上搜索后,找到了一些资源,我将数据源配置更改为:

  # Configuration needed to keep the JPA entity open
  # Used from here: https://github.com/GluuFederation/message-consumer/issues/4
  # This would be enough: https://github.com/netgloo/spring-boot-samples/blob/master/spring-boot-mysql-springdatajpa-hibernate/src/main/resources/application.properties
  datasource:
    tomcat:
      initial-size: 34
      max-active: 377
      max-idle: 233
      min-idle: 89
      time-between-eviction-runs-millis: 34000
      min-evictable-idle-time-millis: 55000
      validation-query: SELECT 1
      validation-interval: 4000
      test-on-borrow: true
      remove-abandoned: true
      remove-abandoned-timeout: 55

我已经检查了,可以使用Workbench直接连接到数据库,并且进行了一些查询,没有出现问题。

AWS容器的运行状况也很好(据我所知,它是绿色的:)

有什么想法吗?

经过尝试几件事,失败了。 我决定改用平木

  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    hikari:
      minimum-idle: 5
      maximum-pool-size: 10
      idle-timeout: 30000
      connection-test-query: SELECT 1

使用这种配置,我没有遇到任何麻烦。

我正在使用Springboot Hiraki示例存储库提供的属性

https://github.com/netgloo/spring-boot-samples/blob/master/spring-boot-mysql-springdatajpa-hibernate/src/main/resources/application.properties

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM