数据库连接正在关闭

时间:2015-11-09 13:35:36

标签: java spring hibernate tomcat jdbc

从Spring-hibernate-application我们触发一个存储过程大约需要30分钟来执行..当它返回并且spring尝试提交事务时因为我们使用的是spring transaction Managment,它失败了以下异常说连接已关闭。

我们正在使用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).

请帮忙。

1 个答案:

答案 0 :(得分:0)

这可能是因为你的休眠连接超时了。 您需要增加休眠连接的超时时间。

我不知道您正在使用哪个提供商,但谷歌不应该太难以找出如何更改超时