AnsweredAssumed Answered

Postgres connection closed

Question asked by sanket on May 14, 2014
Latest reply on May 22, 2014 by yogeshpj
My client is getting the below exception in logs ONLY when a schedular runs at midnight.
The postgres service is running and getting successfully connected to alfresco when server starts.



2014-05-12 04:40:36,304  ERROR [hibernate.transaction.JDBCTransaction] [DefaultScheduler_Worker-2] JDBC begin failed
org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.getAutoCommit(AbstractJdbc2Connection.java:680)
        at org.apache.commons.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:337)
        at org.apache.commons.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:337)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getAutoCommit(PoolingDataSource.java:235)
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransa
ctionManager.java:371)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAsp
ectSupport.java:335)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAsp
ectSupport.java:273)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.begin(SpringAwareUserTransaction.java:411)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:377)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy14.getProperty(Unknown Source)
        at com.clms.vfr.suppliers.SupplierSync.getSiteName(SupplierSync.java:125)
        at com.clms.vfr.suppliers.SupplierSync.execute(SupplierSync.java:73)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
2014-05-12 04:59:00,707  WARN  [jdbc.support.SQLErrorCodesFactory] [DefaultScheduler_Worker-4] Error while extracting datab
ase product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org
.postgresql.util.PSQLException: This connection has been closed.
        at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:296)
        at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320)
        at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:213)
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTransl
ator.java:141)
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.ja
va:104)
        at org.mybatis.spring.MyBatisExceptionTranslator.initExceptionTranslator(MyBatisExceptionTranslator.java:84)
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:70)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346)
        at $Proxy5.selectOne(Unknown Source)
        at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:154)
        at org.alfresco.repo.domain.locks.ibatis.LockDAOImpl.getLockResource(LockDAOImpl.java:63)
        at org.alfresco.repo.domain.locks.AbstractLockDAOImpl.getLock(AbstractLockDAOImpl.java:79)
        at org.alfresco.repo.lock.JobLockServiceImpl$4.execute(JobLockServiceImpl.java:449)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at org.alfresco.repo.lock.JobLockServiceImpl.doWithRetry(JobLockServiceImpl.java:501)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLockImpl(JobLockServiceImpl.java:455)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:218)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:209)
        at org.alfresco.repo.activities.post.cleanup.PostCleaner.execute(PostCleaner.java:99)
        at org.alfresco.repo.activities.post.cleanup.PostCleanupJob.execute(PostCleanupJob.java:50)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
        at org.postgresql.jdbc4.Jdbc4Connection.getMetaData(Jdbc4Connection.java:54)
        at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:345)
        at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:345)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getMetaData(PoolingDataSource.java:245)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:56)
        at $Proxy4.getMetaData(Unknown Source)
        at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:285)
        … 21 more
2014-05-12 04:59:00,711  ERROR [hibernate.transaction.JDBCTransaction] [DefaultScheduler_Worker-4] JDBC rollback failed
org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.rollback(AbstractJdbc2Connection.java:731)
        at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:368)
        at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:368)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:323)
        at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:183)
        at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:676)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTrans
actionManager.java:845)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionM
anager.java:822)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(Transactio
nAspectSupport.java:411)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.completeTransactionAfterThrowing(SpringAwareUserTransac
tion.java:567)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.rollback(SpringAwareUserTransaction.java:537)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
        at org.alfresco.repo.lock.JobLockServiceImpl.doWithRetry(JobLockServiceImpl.java:501)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLockImpl(JobLockServiceImpl.java:455)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:218)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:209)
        at org.alfresco.repo.activities.post.cleanup.PostCleaner.execute(PostCleaner.java:99)
        at org.alfresco.repo.activities.post.cleanup.PostCleanupJob.execute(PostCleanupJob.java:50)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
2014-05-12 04:59:00,715  ERROR [util.transaction.SpringAwareUserTransaction] [DefaultScheduler_Worker-4] Application except
ion overridden by rollback exception
java.lang.Exception
        at org.alfresco.util.transaction.SpringAwareUserTransaction.rollback(SpringAwareUserTransaction.java:537)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
        at org.alfresco.repo.lock.JobLockServiceImpl.doWithRetry(JobLockServiceImpl.java:501)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLockImpl(JobLockServiceImpl.java:455)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:218)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:209)
        at org.alfresco.repo.activities.post.cleanup.PostCleaner.execute(PostCleaner.java:99)
        at org.alfresco.repo.activities.post.cleanup.PostCleanupJob.execute(PostCleanupJob.java:50)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
2014-05-12 04:59:00,716  ERROR [repo.transaction.RetryingTransactionHelper] [DefaultScheduler_Worker-4] Rollback failure.
Normal retry behaviour will resume.
org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is
org.hibernate.TransactionException: JDBC rollback failed
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:679)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTrans
actionManager.java:845)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionM
anager.java:822)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(Transactio
nAspectSupport.java:411)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.completeTransactionAfterThrowing(SpringAwareUserTransac
tion.java:567)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.rollback(SpringAwareUserTransaction.java:537)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
        at org.alfresco.repo.lock.JobLockServiceImpl.doWithRetry(JobLockServiceImpl.java:501)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLockImpl(JobLockServiceImpl.java:455)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:218)
        at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:209)
        at org.alfresco.repo.activities.post.cleanup.PostCleaner.execute(PostCleaner.java:99)
        at org.alfresco.repo.activities.post.cleanup.PostCleanupJob.execute(PostCleanupJob.java:50)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
Caused by: org.hibernate.TransactionException: JDBC rollback failed
        at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:170)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:676)
        … 14 more
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.rollback(AbstractJdbc2Connection.java:731)
        at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:368)
        at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:368)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:323)
        at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:183)
        at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162)
        … 15 more

Outcomes