-->
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.  [ 3 posts ] 
Author Message
 Post subject: switching to c3p0 causes PSQLException
PostPosted: Tue Jan 23, 2007 4:34 pm 
Newbie

Joined: Wed Jun 01, 2005 7:51 pm
Posts: 13
The code below works fine using the default Hibernate connection pool manager.
However, if I switch to c3p0, I get a PSQLException. I have determined that the
connection is open. Any clues as to why would be appreciated.

Thanks,
Brian
Hibernate version:
3.2.1
Mapping documents:
<property name="c3p0.acquire_increment">2</property>
<property name="c3p0.idle_test_period">300</property> <!-- seconds -->
<property name="c3p0.max_size">14</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">0</property> <!-- seconds -->
Code between sessionFactory.openSession() and session.close():
con = objectManager.getHibernateSession().connection();
stmt = con.createStatement();
// statements to construct 'viewStr' omitted
stmt.executeUpdate(viewStr); // <-- this causes the exception
if (!con.getAutoCommit()) con.commit();
Full stack trace of any exception that occurs:
com.timestock.common.exceptions.TsRuntimeException: org.postgresql.util.PSQLException: This statement has been closed.
at com.timestock.tess.util.ReportUtils.getRowsFromViews(ReportUtils.java:1070)
at com.timestock.tess.util.ReportUtils.getQualityData(ReportUtils.java:292)
at com.timestock.tess.web.controllers.AbstractQualityReportController.referenceData(AbstractQualityReportController.java:79)
at com.timestock.tess.web.controllers.TranQualityReportController.referenceData(TranQualityReportController.java:33)
at org.springframework.web.servlet.mvc.AbstractFormController.showForm(AbstractFormController.java:559)
at org.springframework.web.servlet.mvc.SimpleFormController.showForm(SimpleFormController.java:198)
at com.timestock.tess.web.controllers.TranQualityReportController.showForm(TranQualityReportController.java:69)
at org.springframework.web.servlet.mvc.SimpleFormController.showForm(SimpleFormController.java:175)
at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:323)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:263)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.timestock.tess.services.licensing.LicenseFilter.doFilter(LicenseFilter.java:92)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
at org.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:197)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
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:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
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.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:306)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:745)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.postgresql.util.PSQLException: This statement has been closed.
at org.postgresql.jdbc2.AbstractJdbc2Statement.checkClosed(AbstractJdbc2Statement.java:2390)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:329)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:278)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)
at com.timestock.tess.util.ReportUtils.getRowsFromViews(ReportUtils.java:1032)
... 56 more
Name and version of the database you are using:
Postgres 8.1.2
The generated SQL (show_sql=true):
n/a
Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 24, 2007 8:11 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 5:33 am
Posts: 31
I had a similar problem when I switched to c3p0.
Mine was solved by changing hbm2dll to false

_________________
Emil
Don't forget to rate, I'm desperate!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 24, 2007 2:06 pm 
Newbie

Joined: Wed Jun 01, 2005 7:51 pm
Posts: 13
I've changed my code to:

SessionFactoryImplementor factory = (SessionFactoryImplementor) objectManager.getObjectDao().getSessionFactory();

conn = factory.getConnectionProvider().getConnection();
stmt = conn.createStatement();
....
stmt.executeUpdate(viewStr);

This works for both c3p0 and the default pool manager.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.