Issue with c3p0 when using h2-1.3.161.

768 views
Skip to first unread message

steve

unread,
Oct 31, 2011, 7:00:09 AM10/31/11
to H2 Database
Hello
Firstly , thank you for this awesome database. I've upgraded to the
current release and noticed that the application wasn't functioning as
expected. Turns out a database connection could be established by
hibernate.

I've attached a stacktrace.


java.sql.SQLException: Connections could not be acquired from the
underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
529)
at
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:
128)
at
org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:
78)
at
org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:
51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
168)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
375)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:
1872)
at
com.callidus.db.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:
68)
at com.callidus.db.dao.BaseDAO.getSession(BaseDAO.java:12)
at
com.callidus.db.dao.EmbeddedAppsDAO.getAllActiveApplications(EmbeddedAppsDAO.java:
16)
at
com.callidus.agents.local.WebServerSetupAgent.getAllHandlers(WebServerSetupAgent.java:
160)
at
com.callidus.agents.local.WebServerSetupAgent.configureHttpServer(WebServerSetupAgent.java:
39)
at
com.callidus.agents.local.WebServerSetupAgent.execute(WebServerSetupAgent.java:
63)
at com.callidus.agents.CallidusAgent.call(CallidusAgent.java:27)
at com.callidus.agents.CallidusAgent.runAgent(CallidusAgent.java:79)
at com.callidus.server.Server.startUpServer(Server.java:143)
at com.callidus.Callidus.main(Callidus.java:18)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException:
A ResourcePool could not acquire a resource from its primary factory
or source.
at
com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:
1319)
at
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:
557)
at
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:
477)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
525)
... 16 more
61949 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - could not
complete schema update
java.sql.SQLException: Connections could not be acquired from the
underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
529)
at
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:
128)
at
org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:
78)
at
org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:
51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
168)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
375)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:
1872)
at
com.callidus.db.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:
68)
at com.callidus.db.dao.BaseDAO.getSession(BaseDAO.java:12)
at
com.callidus.db.dao.EmbeddedAppsDAO.getAllActiveApplications(EmbeddedAppsDAO.java:
16)
at
com.callidus.agents.local.WebServerSetupAgent.getAllHandlers(WebServerSetupAgent.java:
160)
at
com.callidus.agents.local.WebServerSetupAgent.configureHttpServer(WebServerSetupAgent.java:
39)
at
com.callidus.agents.local.WebServerSetupAgent.execute(WebServerSetupAgent.java:
63)
at com.callidus.agents.CallidusAgent.call(CallidusAgent.java:27)
at com.callidus.agents.CallidusAgent.runAgent(CallidusAgent.java:79)
at com.callidus.server.Server.startUpServer(Server.java:143)
at com.callidus.Callidus.main(Callidus.java:18)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException:
A ResourcePool could not acquire a resource from its primary factory
or source.
at
com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:
1319)
at
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:
557)
at
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:
477)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
525)
... 16 more
106118 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL
Error: 0, SQLState: null
106118 [main] ERROR org.hibernate.util.JDBCExceptionReporter -
Connections could not be acquired from the underlying database!
Exception in thread "main"
org.hibernate.exception.GenericJDBCException: Cannot open connection
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:
140)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:
128)
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.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:
161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:
1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:
274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
at
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:
365)
at
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:
196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at
com.callidus.db.dao.EmbeddedAppsDAO.getAllActiveApplications(EmbeddedAppsDAO.java:
19)
at
com.callidus.agents.local.WebServerSetupAgent.getAllHandlers(WebServerSetupAgent.java:
160)
at
com.callidus.agents.local.WebServerSetupAgent.configureHttpServer(WebServerSetupAgent.java:
39)
at
com.callidus.agents.local.WebServerSetupAgent.execute(WebServerSetupAgent.java:
63)
at com.callidus.agents.CallidusAgent.call(CallidusAgent.java:27)
at com.callidus.agents.CallidusAgent.runAgent(CallidusAgent.java:79)
at com.callidus.server.Server.startUpServer(Server.java:143)
at com.callidus.Callidus.main(Callidus.java:18)
Caused by: java.sql.SQLException: Connections could not be acquired
from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
529)
at
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:
128)
at
org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:
78)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:
446)
... 21 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException:
A ResourcePool could not acquire a resource from its primary factory
or source.
at
com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:
1319)
at
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:
557)
at
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:
477)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:
525)

Noel Grandin

unread,
Oct 31, 2011, 8:20:52 AM10/31/11
to h2-da...@googlegroups.com, steve
you probably haven't specified the database URL properly.

see http://www.h2database.com/html/tutorial.html#connecting_using_jdbc

Noel Grandin

unread,
Oct 31, 2011, 2:17:53 PM10/31/11
to Elton (GMAIL), h2-da...@googlegroups.com
Hmmm, interesting.
Is there perhaps an error message earlier on in the log?
I ask because I can't see a root cause belonging to H2 anywhere in
that stacktrace.

On Mon, Oct 31, 2011 at 18:42, Elton (GMAIL) <elto...@gmail.com> wrote:
> Hi Noel,
> Thank you for replying.  It is not an issue related to the DB connection
> string. I must add here that using the previous  x.x.160 version works and
> only when I replace the jar with vx.x.161 do I run into this problem.
>
> Regards
> Elton Kent

Noel Grandin

unread,
Nov 1, 2011, 3:09:35 AM11/1/11
to Elton (GMAIL), H2 Database
There should still be some kind of earlier exception, either a timeout exception, or a failed-to-connect exception, or a
jdbc-returned-an-error-code exception.
But there is nothing here that mentions H2 at all.


Elton (GMAIL) wrote:
> Correct. That�s because I use the c3p0 connection pool which establishes the
> connection to the database. C3P0 throws an exception if the database
> connection is not returned within the given time interval. So the issue I'm
> trying to highlight here is the compatibility of the current version with
> c3p0 DB connection pool library.

Thomas Mueller

unread,
Nov 1, 2011, 3:24:39 AM11/1/11
to h2-da...@googlegroups.com
Hi,

Yes, I'm afraid without more details it's not possible to analyze this problem. You could ask at the c3p0 mailing list why the underlying SQL exception is swallowed, and how to retrieve it.

Regards,
Thomas


On Tuesday, November 1, 2011, Noel Grandin wrote:
There should still be some kind of earlier exception, either a timeout exception, or a failed-to-connect exception, or a
jdbc-returned-an-error-code exception.
But there is nothing here that mentions H2 at all.


Elton (GMAIL) wrote:
> Correct. That’s because I use the c3p0 connection pool which establishes the
Reply all
Reply to author
Forward
0 new messages