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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 2.1.3 + c3p0 + cocoon 2.1.5-dev throw strange ex
PostPosted: Fri May 07, 2004 4:37 am 
Regular
Regular

Joined: Wed May 05, 2004 8:01 am
Posts: 53
I have been able to integrate cocoon with hibernate 2.1.2 + c3p0. Lately I have downloaded hibernate 2.1.3 and upgraded those libs in my installation:
- hibernate2.jar
- c3p0
- cglib

After those changes hibernate started to choke on obtaining connection from pool:

Code:
20:48:16.721 EVENT  Checking Resource aliases
20:48:17.003 EVENT  Starting Jetty/4.2.19
20:48:17.018 EVENT  Started ServletHttpContext[/]
20:48:17.018 EVENT  Started SocketListener on 127.0.0.1:9091
20:48:17.018 EVENT  Started org.mortbay.jetty.Server@1975b59
20:48:17.065 EVENT  Statistics on = false for org.mortbay.jetty.Server@54a328
20:48:17.065 EVENT  Starting Jetty/4.2.19
20:48:17.362 EVENT  Started WebApplicationContext[/,webapp]
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@18bbc5a [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@97eded [ acquireIncrement -> 2, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 3000, initialPoolSize -> 1, maxIdleTime -> 5000, maxPoolSize -> 15, maxStatements -> 100, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@facf0b [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:microsoft:sqlserver://mainframe;DatabaseName=GeminiBJmefiu;SelectMethod=cursor;SendStringParametersAsUnicode=false, properties -> {user=sa, password=} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
20:48:22.628 EVENT  Started SocketListener on 0.0.0.0:9090
20:48:22.628 EVENT  Started org.mortbay.jetty.Server@54a328
20:48:32,065  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: null
20:48:32,065 ERROR JDBCExceptionReporter:46 - com.mchange.v2.c3p0.PoolBackedDataSource@18bbc5a [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@97eded [ acquireIncrement -> 2, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 3000, initialPoolSize -> 1, maxIdleTime -> 5000, maxPoolSize -> 15, maxStatements -> 100, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@facf0b [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:microsoft:sqlserver://mainframe;DatabaseName=GeminiBJmefiu;SelectMethod=cursor;SendStringParametersAsUnicode=false, properties -> {user=sa, password=} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]  has been closed() -- you can no longer use it.
20:48:32,081 ERROR JDBCExceptionReporter:38 - Cannot open connection
java.sql.SQLException: com.mchange.v2.c3p0.PoolBackedDataSource@18bbc5a [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@97eded [ acquireIncrement -> 2, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 3000, initialPoolSize -> 1, maxIdleTime -> 5000, maxPoolSize -> 15, maxStatements -> 100, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@facf0b [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:microsoft:sqlserver://mainframe;DatabaseName=GeminiBJmefiu;SelectMethod=cursor;SendStringParametersAsUnicode=false, properties -> {user=sa, password=} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]  has been closed() -- you can no longer use it.
   at com.mchange.v2.c3p0.PoolBackedDataSource.assertCpds(PoolBackedDataSource.java:129)
   at com.mchange.v2.c3p0.PoolBackedDataSource.getPoolManager(PoolBackedDataSource.java:141)
   at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:58)
   at net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:33)
   at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
   at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3297)
   at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3277)
   at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
   at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
   at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
   at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
   at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
   at net.sf.hibernate.loader.Loader.list(Loader.java:946)
   at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1509)
   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:324)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
   at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
   at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
   at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
   at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
   at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
   at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
   at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:693)
   at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
   at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
   at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
   at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
   at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
   at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
   at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
   at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
   at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
   at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
   at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
   at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
   at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
   at org.apache.cocoon.Cocoon.process(Cocoon.java:619)
   at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1078)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
   at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
   at com.mobilebox.hibernate.PersistenceManager.doFilter(PersistenceManager.java:66)
   at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
   at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
   at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
   at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
   at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
   at org.mortbay.http.HttpServer.service(HttpServer.java:879)
   at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
   at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
   at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
   at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
   at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
   at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:501)
CTRL-C trapped.  Shutting down.
CTRL-C trapped.  Forcing immediate shutdown.
<-- Wrapper Stopped


The error is strange. I tried to run the test application in the same environment (all same jars were on the classpath) - it worked. So it works standalone and does not work in servlet environment ( jetty + cocoon ).

The most important thing is that if I downgrade hibernate2.jar only ( to 2.1.2 version ) leaving c3p0 and cglib from 2.1.3 distribution my site starts to work again.

The problem does not occur if I use hibernate built-in pool (the one not meant for production use).

Is it some kind of jar problem? I cannot find any workaround for this problem and I am afraid I won't be able to use any further releases of hibernate because of the same error.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 6:54 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
ouzo,

somehow your PoolBackedDataSource is being explicitly destroyed. newer versions of hibernate will destroy the DataSource when its C3P0ConnectionProvider is closed, I think. But why that would be happening in your case is a mystery.

if you like, i'll send you a debug version of c3p0 that will dump the stack trace that closes the your DataSource. write me directly -- I'm <swaldman@mchange.com> -- if you want this.

good luck!

Steve (c3p0 maintainer)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 3:24 pm 
Newbie

Joined: Mon Mar 06, 2006 3:17 pm
Posts: 5
I'm having the same problem. The stack trace is below. It looks like it is closing the connection after updating the schema.

Have you been able to solve this problem yet?


java.lang.Exception: Closing conn
at com.mchange.v2.c3p0.PoolBackedDataSource.close(PoolBackedDataSource.j
ava:223)
at com.mchange.v2.c3p0.PoolBackedDataSource.close(PoolBackedDataSource.j
ava:238)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:333)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:309)
at org.hibernate.connection.C3P0ConnectionProvider.close(C3P0ConnectionP
rovider.java:118)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:175
)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
295)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1176)
at com.cexppm.data.finder.SessionFactoryFactory.createObjectFor(SessionF
actoryFactory.java:31)
at org.xot.util.cache.ObjectCache.createObjectFor(ObjectCache.java:227)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 4:41 pm 
Newbie

Joined: Mon Mar 06, 2006 3:17 pm
Posts: 5
I'm having the same problem. The stack trace is below. It looks like it is closing the connection after updating the schema.

Have you been able to solve this problem yet?


java.lang.Exception: Closing conn
at com.mchange.v2.c3p0.PoolBackedDataSource.close(PoolBackedDataSource.j
ava:223)
at com.mchange.v2.c3p0.PoolBackedDataSource.close(PoolBackedDataSource.j
ava:238)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:333)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:309)
at org.hibernate.connection.C3P0ConnectionProvider.close(C3P0ConnectionP
rovider.java:118)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:175
)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
295)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1176)
at com.cexppm.data.finder.SessionFactoryFactory.createObjectFor(SessionF
actoryFactory.java:31)
at org.xot.util.cache.ObjectCache.createObjectFor(ObjectCache.java:227)


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