简体   繁体   English

Spring Boot - 应用程序在 PRD 中丢失数据库连接

[英]Spring Boot - Application losing DB connection in PRD

I read a lot of questions here in stackoverflow about this subject and I ended with the following code in my application-prd.properties:我在 stackoverflow 中阅读了很多关于这个主题的问题,并在我的 application-prd.properties 中以以下代码结束:

#PRD IP
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=

# Fix for DB Connection
spring.datasource.tomcat.max-active=10
spring.datasource.tomcat.initial-size=5
spring.datasource.tomcat.max-idle=5
spring.datasource.tomcat.min-idle=1
spring.datasource.tomcat.test-while-idle=true
spring.datasource.tomcat.test-on-borrow=true
spring.datasource.tomcat.validation-query=SELECT 1 FROM DUAL
spring.datasource.tomcat.time-between-eviction-runs-millis=5000
spring.datasource.tomcat.min-evictable-idle-time-millis=60000

#Error fix for JSON conversion
spring.jackson.parser.allow-unquoted-control-chars=true

But, for some reason, the Tomcat with my Spring application suddenly loses the connection with the database, giving the following error:但是,由于某种原因,带有我的 Spring 应用程序的 Tomcat 突然失去了与数据库的连接,出现以下错误:

Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

I don't know what should I do.我不知道我该怎么办。 Its been weeks that I'm struggling with it.我已经为此苦苦挣扎了几个星期。 Is there anything else that I can do?还有什么我可以做的吗? Or can I say that is a firewall issue and the infrastructure team should check something?或者我可以说这是一个防火墙问题,基础设施团队应该检查一些东西吗?

Thank you谢谢

还要检查连接泄漏,可能是某些 txns 没有正确关闭连接,这就是池超出阈值的原因。

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

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