gpt4 book ai didi

java - 数据库连接正在关闭

转载 作者:行者123 更新时间:2023-11-28 23:28:48 25 4
gpt4 key购买 nike

从 Spring-hibernate-application 我们正在触发一个存储过程,该过程大约需要 30 分钟才能执行。当它返回并且 spring 尝试提交事务时,因为我们使用的是 spring 事务管理,它失败并显示以下内容表示连接已关闭的异常。

我们正在使用 tomcat 服务器,应用程序中的连接在 Tomcat JDBC 连接池中进行管理。

Caused by: org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: commit failed
at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:588)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.jpmchase.common.service.adjustment.impl.AdjustmentExistingRecServiceImpl$$EnhancerBySpringCGLIB$$c2ddfbc5.lockUnlockForExport(<generated>)
at com.jpmchase.adjustment.existingRecord.delegate.AdjustmentExistingRecDelegate.processDataAndExportToExcel(AdjustmentExistingRecDelegate.java:1394)
... 25 more
Caused by: org.hibernate.TransactionException: commit failed
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:187)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
... 36 more
Caused by: org.hibernate.TransactionException: unable to commit against JDBC connection
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:116)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:180)
... 37 more
Caused by: java.sql.SQLException: Connection oracle.jdbc.driver.T4CConnection@7c035c41 is closed.
at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:398)
at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:112).

请帮忙。

最佳答案

这可能是因为您的 hibernate 连接超时。您需要增加 hibernate 连接的超时时间。

我不知道您使用的是哪个供应商,但通过谷歌搜索并弄清楚如何更改超时应该不难

关于java - 数据库连接正在关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33610329/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com