-->
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.  [ 9 posts ] 
Author Message
 Post subject: ConnectionTimedout & Brokenpipe requrng server 2 b resta
PostPosted: Thu May 04, 2006 1:08 am 
Newbie

Joined: Thu May 04, 2006 12:57 am
Posts: 8
Two Issues

The first error log indicates the Connection timed out issue.
and the second one indicates a broken pipe issue.

This happens inconsistently in the application requiring the application server to be restarted. Please let me know how this could be resolved
1)

2006-05-03 15:44:13,613 DEBUG [org.hibernate.util.JDBCExceptionReporter] SQL Exception
java.sql.SQLException: Io exception: Connection timed out
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:496)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:511)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:192)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:778)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:634)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:401)
at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:82)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at com.wablink.dao.hibernate.HibernateDAOImpl.saveData(HibernateDAOImpl.java:75)
at com.wablink.model.catalog.RequestForRegistrationBO.SaveRequestForRegistration(RequestForRegistrationBO.java:36)
at com.wablink.presentation.action.RequestForRegistrationAction.wablinkExecute(RequestForRegistrationAction.java:77)
at com.wablink.presentation.action.WablinkAction.execute(WablinkAction.java:227)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
2006-05-03 15:44:13,616 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 17002, SQLState: null
2006-05-03 15:44:13,616 ERROR [org.hibernate.util.JDBCExceptionReporter] Io exception: Connection timed out
2006-05-03 15:44:13,621 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not get next sequence value [select SALES_ORDER_SEQ.nextval from dual]
java.sql.SQLException: Io exception: Connection timed out
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:496)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:511)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:192)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:778)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:634)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:401)
at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:82)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at com.wablink.dao.hibernate.HibernateDAOImpl.saveData(HibernateDAOImpl.java:75)
at com.wablink.model.catalog.RequestForRegistrationBO.SaveRequestForRegistration(RequestForRegistrationBO.java:36)
at com.wablink.presentation.action.RequestForRegistrationAction.wablinkExecute(RequestForRegistrationAction.java:77)
at com.wablink.presentation.action.WablinkAction.execute(WablinkAction.java:227)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
2006-05-03 15:44:13,622 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 17002, SQLState: null
2006-05-03 15:44:13,622 ERROR [org.hibernate.util.JDBCExceptionReporter] Io exception: Connection timed out
2006-05-03 15:44:13,624 DEBUG [com.wablink.dao.hibernate.HibernateDAOSupport] Closing Session of this thread.
2006-05-03 15:44:13,624 DEBUG [org.hibernate.impl.SessionImpl] closing session
2006-05-03 15:44:13,624 DEBUG [org.hibernate.jdbc.ConnectionManager] closing JDBC connection [ (open PreparedStatements: 1, globally: 1) (open ResultSets: 0, globally: 0)]
2006-05-03 15:44:13,624 DEBUG [org.hibernate.connection.D

2)

2006-05-03 15:44:31,783 DEBUG [com.wablink.dao.hibernate.HibernateDAOSupport] Opening new Session for this thread.
2006-05-03 15:44:31,784 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4696823692423168
2006-05-03 15:44:31,784 DEBUG [com.wablink.dao.hibernate.HibernateDAOSupport] Starting new database transaction in this thread.
2006-05-03 15:44:31,784 DEBUG [org.hibernate.transaction.JDBCTransaction] begin
2006-05-03 15:44:31,784 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
2006-05-03 15:44:31,784 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] total checked-out connections: 0
2006-05-03 15:44:31,784 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 1
2006-05-03 15:44:31,784 DEBUG [org.hibernate.transaction.JDBCTransaction] current autocommit status: false
2006-05-03 15:44:31,784 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating detached instance
2006-05-03 15:44:31,784 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20026]
2006-05-03 15:44:31,784 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20026]
2006-05-03 15:44:31,784 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating detached instance
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20027]
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20027]
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating detached instance
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20004]
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] updating [com.wablink.model.wmi.ReceiveMaterial#20004]
2006-05-03 15:44:31,785 DEBUG [com.wablink.dao.hibernate.HibernateDAOSupport] Committing database transaction of this thread.
2006-05-03 15:44:31,785 DEBUG [org.hibernate.transaction.JDBCTransaction] commit
2006-05-03 15:44:31,785 DEBUG [org.hibernate.impl.SessionImpl] automatically flushing session
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] flushing session
2006-05-03 15:44:31,785 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushing entities and processing referenced collections
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.DefaultFlushEntityEventListener] Updating entity: [com.wablink.model.wmi.ReceiveMaterial#20026]
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.DefaultFlushEntityEventListener] Updating entity: [com.wablink.model.wmi.ReceiveMaterial#20027]
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.DefaultFlushEntityEventListener] Updating entity: [com.wablink.model.wmi.ReceiveMaterial#20004]
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Processing unreferenced collections
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Scheduling collection removes/(re)creates/updates
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 3 updates, 0 deletions to 3 objects
2006-05-03 15:44:31,786 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2006-05-03 15:44:31,786 DEBUG [org.hibernate.pretty.Printer] listing entities:
2006-05-03 15:44:31,787 DEBUG [org.hibernate.pretty.Printer] com.wablink.model.wmi.ReceiveMaterial{receivedDate=null, updatedByPerson=138, discrepancyDesc=, confirmed=C, costCenterPk=3, updateDate=2006-05-03 15:44:31, pk=20027}
2006-05-03 15:44:31,788 DEBUG [org.hibernate.pretty.Printer] com.wablink.model.wmi.ReceiveMaterial{receivedDate=null, updatedByPerson=138, discrepancyDesc=, confirmed=C, costCenterPk=3, updateDate=2006-05-03 15:44:31, pk=20004}
2006-05-03 15:44:31,788 DEBUG [org.hibernate.pretty.Printer] com.wablink.model.wmi.ReceiveMaterial{receivedDate=null, updatedByPerson=138, discrepancyDesc=, confirmed=C, costCenterPk=3, updateDate=2006-05-03 15:44:31, pk=20026}
2006-05-03 15:44:31,788 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] executing flush
2006-05-03 15:44:31,788 DEBUG [org.hibernate.persister.entity.BasicEntityPersister] Updating entity: [com.wablink.model.wmi.ReceiveMaterial#20026]
2006-05-03 15:44:31,788 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 1)
2006-05-03 15:44:31,788 DEBUG [org.hibernate.SQL] update WMI_SHIPMENTS set CONFIRMED=?, DESCRIPTION_OF_DISCREPANCY=?, LAST_UPDATE_DATE=?, LAST_UPDATE_PERSON=?, RECEIVED_DATE=?, COSTCTR_PK=? where PK=?
2006-05-03 15:44:31,788 INFO [STDOUT] Hibernate: update WMI_SHIPMENTS set CONFIRMED=?, DESCRIPTION_OF_DISCREPANCY=?, LAST_UPDATE_DATE=?, LAST_UPDATE_PERSON=?, RECEIVED_DATE=?, COSTCTR_PK=? where PK=?
2006-05-03 15:44:31,789 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
2006-05-03 15:44:31,789 DEBUG [org.hibernate.util.JDBCExceptionReporter] SQL Exception
java.sql.SQLException: Io exception: Broken pipe
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:496)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:511)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:192)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:778)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:634)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:401)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1954)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.wablink.dao.hibernate.HibernateDAOSupport.commitTransaction(HibernateDAOSupport.java:283)
at com.wablink.dao.hibernate.HibernateDAOImpl.updateData(HibernateDAOImpl.java:348)
at com.wablink.model.wmi.ReceiveMaterialBO.updateReceive(ReceiveMaterialBO.java:66)
at com.wablink.presentation.action.WMIReceiveMaterialAction.wablinkExecute(WMIReceiveMaterialAction.java:248)
at com.wablink.presentation.action.WablinkAction.execute(WablinkAction.java:227)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
2006-05-03 15:44:31,792 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 17002, SQLState: null
2006-05-03 15:44:31,792 ERROR [org.hibernate.util.JDBCExceptionReporter] Io exception: Broken pipe
2006-05-03 15:44:31,792 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not update: [com.wablink.model.wmi.ReceiveMaterial#20026] [update WMI_SHIPMENTS set CONFIRMED=?, DESCRIPTION_OF_DISCREPANCY=?, LAST_UPDATE_DATE=?, LAST_UPDATE_PERSON=?, RECEIVED_DATE=?, COSTCTR_PK=? where PK=?]
java.sql.SQLException: Io exception: Broken pipe
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:496)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:511)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:192)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:778)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:634)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:401)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1954)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.wablink.dao.hibernate.HibernateDAOSupport.commitTransaction(HibernateDAOSupport.java:283)
at com.wablink.dao.hibernate.HibernateDAOImpl.updateData(HibernateDAOImpl.java:348)
at com.wablink.model.wmi.ReceiveMaterialBO.updateReceive(ReceiveMaterialBO.java:66)
at com.wablink.presentation.action.WMIReceiveMaterialAction.wablinkExecute(WMIReceiveMaterialAction.java:248)
at com.wablink.presentation.action.WablinkAction.execute(WablinkAction.java:227)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
2006-05-03 15:44:31,794 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 17002, SQLState: null
2006-05-03 15:44:31,794 ERROR [org.hibernate.util.JDBCExceptionReporter] Io exception: Broken pipe
2006-05-03 15:44:31,794 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [com.wablink.model.wmi.ReceiveMaterial#20026]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2000)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.wablink.dao.hibernate.HibernateDAOSupport.commitTransaction(HibernateDAOSupport.java:283)
at com.wablink.dao.hibernate.HibernateDAOImpl.updateData(HibernateDAOImpl.java:348)
at com.wablink.model.wmi.ReceiveMaterialBO.updateReceive(ReceiveMaterialBO.java:66)
at com.wablink.presentation.action.WMIReceiveMaterialAction.wablinkExecute(WMIReceiveMaterialAction.java:248)
at com.wablink.presentation.action.WablinkAction.execute(WablinkAction.java:227)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: Io exception: Broken pipe
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:496)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:511)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:192)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:778)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:634)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:401)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1954)
... 41 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 2:13 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
They're probably both symptoms of the same error. I'm guessing that you are accidentally using long sessions. Are you calling SessionFactory.openSession (or whatever method you use to get sessions) more often than session.close()? They have to be balanced, otherwise you'll leave dangling connections. Connections eventually time out, sesion restants.

The session restart shouldn't require you to restart the appserver. That should just cause you to refresh a page or something, to kick the session and make it reconnect. However, if you have a serious connection leak, then eventually you'll have to restart the appserver so that all those timed-out connections are properly released on the dbserver side. The dbserver has access to a limited number of connections: if you just let them leak, you get this kind of thing.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 2:46 am 
Newbie

Joined: Thu May 04, 2006 12:57 am
Posts: 8
In every method where we call getSession, there is always a finally block which closes the session.
Also, this is the values set for the parameter connection.pool_size in hibernate.cfg.xml.

Also, if you check the error log below, it closes the session too


2006-05-04 01:57:59,841 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
2006-05-04 01:57:59,841 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
2006-05-04 01:57:59,842 DEBUG [com.wablink.dao.hibernate.HibernateDAOSupport] Closing Session of this thread.
2006-05-04 01:57:59,842 DEBUG [org.hibernate.impl.SessionImpl] closing session
2006-05-04 01:57:59,842 DEBUG [org.hibernate.jdbc.ConnectionManager] closing JDBC connection [ (open PreparedStatements: 1, globally: 18) (open ResultSets: 0, globally: 0)]
2006-05-04 01:57:59,842 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] returning connection to pool, pool size: 2
2006-05-04 01:57:59,842 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
2006-05-04 01:57:59,842 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">50</property>


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 3:58 am 
Newbie

Joined: Fri Apr 28, 2006 1:09 pm
Posts: 9
Check the connection timeout configured in hibernate against the connection timeout on your database. If you database connection timeout is shorter than the hibernate one then your database will be closing connections in hibernates pool before it's ready.

Theres an example of the c3p0 connection pool timeout configuration at http://www.hibernate.org/214.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 5:23 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Assuming that your code is still in testing, set your pool size to 2 or 3. That'll help with debugging.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 6:00 am 
Newbie

Joined: Thu May 04, 2006 12:57 am
Posts: 8
I am using this file to get the as the HibernateUtil class
The application uses JDBC for retrieval and Hiberate for update, inserts.
It runs on a jboss server and has its own connection pooling for jdbc. I have configured the hibernate.cfg.xml to use the same datasource that is being used for JDBC in the application.

Do we need to mention the datasource to be picked up in the HibernateUtil class



---------------------------------------------

import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;

/**
* Basic Hibernate helper class, handles SessionFactory, Session and Transaction.
* <p>
* Uses a static initializer to read startup options and initialize
* <tt>Configuration</tt> and <tt>SessionFactory</tt>.
* <p>
* This class tries to figure out if either ThreadLocal handling of the
* <tt>Session</tt> and <tt>Transaction</tt> should be used, for resource local
* transactions or BMT, or if CMT with automatic <tt>Session</tt> handling is enabled.
* <p>
* To keep your DAOs free from any of this, just call <tt>HibernateUtil.getCurrentSession()</tt>
* in the constructor of each DAO., The recommended way to
* set resource local or BMT transaction boundaries is an interceptor, or a request filter.
* <p>
* This class also tries to figure out if JNDI binding of the <tt>SessionFactory</tt>
* is used, otherwise it falls back to a global static variable (Singleton).
* <p>
* If you want to assign a global interceptor, set its fully qualified
* class name with the system (or hibernate.properties/hibernate.cfg.xml) property
* <tt>hibernate.util.interceptor_class</tt>. It will be loaded and instantiated
* on static initialization of HibernateUtil; it has to have a
* no-argument constructor. You can call <tt>getInterceptor()</tt> if
* you need to provide settings before using the interceptor.
* <p>
* Note: This class supports annotations by default, hence needs JDK 5.0
* and the Hibernate Annotations library on the classpath. Change the single
* commented line in the source to make it compile and run on older JDKs with
* XML mapping files only.
*
* @author christian@hibernate.org
*/
public class HibernateDAOSupport {

private static Log log = LogFactory.getLog(HibernateDAOSupport.class);

private static final String INTERCEPTOR_CLASS = "hibernate.util.interceptor_class";

private static Configuration configuration;
private static SessionFactory sessionFactory;
private static ThreadLocal threadSession = new ThreadLocal();
private static ThreadLocal threadTransaction = new ThreadLocal();

private static boolean useThreadLocal = true;

static {
// Create the initial SessionFactory from the default configuration files
try {

// Replace with Configuration() if you don't use annotations or JDK 5.0
configuration = new Configuration();

// This custom entity resolver supports entity placeholders in XML mapping files
// and tries to resolve them on the classpath as a resource
//configuration.setEntityResolver(new ImportFromClassPathEntityResolver());

// Read not only hibernate.properties, but also hibernate.cfg.xml
configuration.configure();

// Assign a global, user-defined interceptor with no-arg constructor
String interceptorName = configuration.getProperty(INTERCEPTOR_CLASS);
if (interceptorName != null) {
Class interceptorClass =
HibernateDAOSupport.class.getClassLoader().loadClass(interceptorName);
Interceptor interceptor = (Interceptor)interceptorClass.newInstance();
configuration.setInterceptor(interceptor);
}

// Disable ThreadLocal Session/Transaction handling if CMT is used
if (org.hibernate.transaction.CMTTransactionFactory.class.getName()
.equals( configuration.getProperty(Environment.TRANSACTION_STRATEGY) ) )
useThreadLocal = false;

if (configuration.getProperty(Environment.SESSION_FACTORY_NAME) != null) {
// Let Hibernate bind it to JNDI
configuration.buildSessionFactory();
} else {
// or use static variable handling
sessionFactory = configuration.buildSessionFactory();
}

} catch (Throwable ex) {
// We have to catch Throwable, otherwise we will miss
// NoClassDefFoundError and other subclasses of Error
log.error("Building SessionFactory failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}

/**
* Returns the original Hibernate configuration.
*
* @return Configuration
*/
public static Configuration getConfiguration() {
return configuration;
}

/**
* Returns the global SessionFactory.
*
* @return SessionFactory
*/
public static SessionFactory getSessionFactory() {
SessionFactory sf = null;
String sfName = configuration.getProperty(Environment.SESSION_FACTORY_NAME);
if ( sfName != null) {
log.debug("Looking up SessionFactory in JNDI.");
try {
sf = (SessionFactory) new InitialContext().lookup(sfName);
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
} else {
sf = sessionFactory;
}
if (sf == null)
throw new IllegalStateException("SessionFactory not available.");
return sf;
}

/**
* Closes the current SessionFactory and releases all resources.
* <p>
* The only other method that can be called on HibernateUtil
* after this one is rebuildSessionFactory(Configuration).
*/
public static void shutdown() {
log.debug("Shutting down Hibernate.");
// Close caches and connection pools
getSessionFactory().close();

// Clear static variables
configuration = null;
sessionFactory = null;

// Clear ThreadLocal variables
threadSession.set(null);
threadTransaction.set(null);
}


/**
* Rebuild the SessionFactory with the static Configuration.
* <p>
* This method also closes the old SessionFactory before, if still open.
* Note that this method should only be used with static SessionFactory
* management, not with JNDI or any other external registry.
*/
public static void rebuildSessionFactory() {
log.debug("Using current Configuration for rebuild.");
rebuildSessionFactory(configuration);
}

/**
* Rebuild the SessionFactory with the given Hibernate Configuration.
* <p>
* HibernateUtil does not configure() the given Configuration object,
* it directly calls buildSessionFactory(). This method also closes
* the old SessionFactory before, if still open.
*
* @param cfg
*/
public static void rebuildSessionFactory(Configuration cfg) {
log.debug("Rebuilding the SessionFactory from given Configuration.");
synchronized(sessionFactory) {
if (sessionFactory != null && !sessionFactory.isClosed())
sessionFactory.close();
if (cfg.getProperty(Environment.SESSION_FACTORY_NAME) != null)
cfg.buildSessionFactory();
else
sessionFactory = cfg.buildSessionFactory();
configuration = cfg;
}
}

/**
* Retrieves the current Session local to the thread.
* <p/>
* If no Session is open, opens a new Session for the running thread.
* If CMT is used, returns the Session bound to the current JTA
* container transaction. Most other operations on this class will
* then be no-ops or not supported, the container handles Session
* and Transaction boundaries, ThreadLocals are not used.
*
* @return Session
*/
public static Session getCurrentSession() {
if (useThreadLocal) {
Session s = (Session) threadSession.get();
if (s == null) {
log.debug("Opening new Session for this thread.");
s = getSessionFactory().openSession();
threadSession.set(s);
}
return s;
} else {
return getSessionFactory().getCurrentSession();
}
}

/**
* Closes the Session local to the thread.
* <p>
* Is a no-op (with warning) if called in a CMT environment. Should be
* used in non-managed environments with resource local transactions, or
* with EJBs and bean-managed transactions.
*/
public static void closeSession() {
try{
if (useThreadLocal) {
Session s = (Session) threadSession.get();
threadSession.set(null);
if (s != null && s.isOpen()) {
log.debug("Closing Session of this thread.");
s.close();
}
} else {
log.warn("Using CMT/JTA, intercepted superfluous close call.");
}
}catch(Exception e)
{

}
}

/**
* Start a new database transaction.
* <p>
* Is a no-op (with warning) if called in a CMT environment. Should be
* used in non-managed environments with resource local transactions, or
* with EJBs and bean-managed transactions. In both cases, it will either
* start a new transaction or join the existing ThreadLocal or JTA
* transaction.
*/
public static void beginTransaction() {
if (useThreadLocal) {
Transaction tx = (Transaction) threadTransaction.get();
if (tx == null) {
log.debug("Starting new database transaction in this thread.");
tx = getCurrentSession().beginTransaction();
threadTransaction.set(tx);
}
} else {
log.warn("Using CMT/JTA, intercepted superfluous tx begin call.");
}
}

/**
* Commit the database transaction.
* <p>
* Is a no-op (with warning) if called in a CMT environment. Should be
* used in non-managed environments with resource local transactions, or
* with EJBs and bean-managed transactions. It will commit the
* ThreadLocal or BMT/JTA transaction.
*/
public static void commitTransaction() {
if (useThreadLocal) {
Transaction tx = (Transaction) threadTransaction.get();
try {
if ( tx != null && !tx.wasCommitted()
&& !tx.wasRolledBack() ) {
log.debug("Committing database transaction of this thread.");
tx.commit();
}
threadTransaction.set(null);
} catch (RuntimeException ex) {
log.error(ex);
rollbackTransaction();
throw ex;
}
} else {
log.warn("Using CMT/JTA, intercepted superfluous tx commit call.");
}
}

/**
* Rollback the database transaction.
* <p>
* Is a no-op (with warning) if called in a CMT environment. Should be
* used in non-managed environments with resource local transactions, or
* with EJBs and bean-managed transactions. It will rollback the
* resource local or BMT/JTA transaction.
*/
public static void rollbackTransaction() {
if (useThreadLocal) {
Transaction tx = (Transaction) threadTransaction.get();
try {
threadTransaction.set(null);
if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() ) {
log.debug("Tyring to rollback database transaction of this thread.");
tx.rollback();
log.debug("Database transaction rolled back.");
}
} catch (RuntimeException ex) {
throw new RuntimeException("Might swallow original cause, check ERROR log!", ex);
} finally {
closeSession();
}
} else {
log.warn("Using CMT/JTA, intercepted superfluous tx rollback call.");
}
}

/**
* Reconnects a Hibernate Session to the current Thread.
* <p>
* Unsupported in a CMT environment.
*
* @param session The Hibernate Session to be reconnected.
*/
public static void reconnect(Session session) {
if (useThreadLocal) {
log.debug("Reconnecting Session to this thread.");
session.reconnect();
threadSession.set(session);
} else {
log.error("Using CMT/JTA, intercepted not supported reconnect call.");
}
}

/**
* Disconnect and return Session from current Thread.
*
* @return Session the disconnected Session
*/
public static Session disconnectSession() {
if (useThreadLocal) {
Session session = getCurrentSession();
threadSession.set(null);
if (session.isConnected() && session.isOpen()) {
log.debug("Disconnecting Session from this thread.");
session.disconnect();
}
return session;
} else {
log.error("Using CMT/JTA, intercepted not supported disconnect call.");
return null;
}
}

/**
* Register a Hibernate interceptor with the current SessionFactory.
* <p>
* Every Session opened is opened with this interceptor after
* registration. Has no effect if the current Session of the
* thread is already open, effective on next close()/getCurrentSession().
* <p>
* Attention: This method effectively restarts Hibernate. If you
* need an interceptor active on static startup of HibernateUtil, set
* the <tt>hibernateutil.interceptor</tt> system property to its
* fully qualified class name.
*/
public static void registerInterceptorAndRebuild(Interceptor interceptor) {
log.debug("Setting new global Hibernate interceptor and restarting.");
configuration.setInterceptor(interceptor);
rebuildSessionFactory();
}

public static Interceptor getInterceptor() {
return configuration.getInterceptor();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 07, 2006 6:30 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
ehrenfrids wrote:
It runs on a jboss server and has its own connection pooling for jdbc. I have configured the hibernate.cfg.xml to use the same datasource that is being used for JDBC in the application.

That might be the source of your problem. You should configure one connection pool, the JBoss one, and have hibernate use it.

I don't know the ins and outs of this, but there's a wiki page about it: http://www.hibernate.org/282.html.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject: Exc: Autocmmit issues and cascade issues
PostPosted: Tue May 09, 2006 2:21 am 
Newbie

Joined: Thu May 04, 2006 12:57 am
Posts: 8
Changed the connection pool to use only one connection pool the datasource which I configured:
Get the following errors in Hibernate

For some functionality:
Caused by: org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan":


For some functionality:
11:36:10,512 ERROR [JDBCTransaction] Could not toggle autocommit
org.hibernate.SessionException: Session is closed


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 5:50 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I can't help with the 2nd problem without more info, but the first one should be easy to fix. It's caused when you load an object with a collection, then use the set<collection> method to completely replace the collection. You can't do that: youse get<collection>().clear() and get<collection>().addAll(otherCollection). This keeps all the hooks into the session cache working, and still accomplishes the task of completely replacing the entire collection.

The rule is: don't use set<collection> on a persistent object. It's fine on an inflated, detached object (one that you'd call session.merge() on), but not on one that's still associated with the cache.

_________________
Code tags are your friend. Know them and use them.


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

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.