-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Begin transaction on a closed connection
PostPosted: Tue Dec 06, 2011 4:38 am 
Newbie

Joined: Tue Dec 06, 2011 4:24 am
Posts: 1
I am using cdo, on top of teneo on top of hibernate on top of postgresql.
After a tcp connection close (hibernating my laptop) I ran into an exception which seemingly means that hibernate tries to begin a transaction on a closed db connection (see at bottom).

I was looking for the issue in the bugzilla, there was one similar bug with Oracle, and the submitter was sent here, but I could not find the corresponding topic. There is one which might be related (viewtopic.php?f=1&t=957369), but I cannot see a useable conclusion there.
On the postgresql jdbc list it has been suggested that I should use a connection pool setting which checks the connection before actually uses it: http://archives.postgresql.org/pgsql-jd ... g00018.php
I could not identify such setting in hibernate documentation.

Question: what settings should I use?

My hibernate related settings:
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.pool_size" value="10"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5433/cdo"/>
<property name="hibernate.connection.username" value="cdo"/>
<property name="hibernate.connection.password" value="cdo"/>
<property name="hibernate.connection.autocommit" value="false"/>
<property name="hibernate.connection.release_mode" value="after_statement"/>

org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:160)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.beginHibernateSession(HibernateStoreAccessor.java:194)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.getHibernateSession(HibernateStoreAccessor.java:266)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil.getHibernateSession(HibernateUtil.java:240)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil.getCDORevision(HibernateUtil.java:451)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreAccessor.readRevision(HibernateStoreAccessor.java:363)
at org.eclipse.emf.cdo.internal.server.Repository.loadRevisions(Repository.java:439)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.loadRevisions(CDORevisionManagerImpl.java:365)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisions(CDORevisionManagerImpl.java:276)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevision(CDORevisionManagerImpl.java:259)
at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.execute(RevisionInfo.java:132)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.LoadRevisionsIndication.responding(LoadRevisionsIndication.java:169)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:133)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerReadIndication.execute(CDOServerReadIndication.java:36)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
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.getAutoCommit(AbstractJdbc2Connection.java:680)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:127)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 25 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.