-->
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: Exception thrown when closing the SessionFactory using c3p0
PostPosted: Tue Feb 06, 2007 11:59 pm 
Newbie

Joined: Wed Oct 18, 2006 1:32 am
Posts: 3
Exception is thrown when closing the SessionFactory using c3p0 and hibernate.hbm2ddl.auto set to "create-drop".

Hibernate version: 3.2.2

Hibernate annotation version: 3.2.1

Full stack trace of any exception that occurs:
INFO Feb 07 2007 03:49:45 org.hibernate.impl.SessionFactoryImpl - closing
INFO Feb 07 2007 03:49:45 org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
DEBUG Feb 07 2007 03:49:45 org.hibernate.tool.hbm2ddl.SchemaExport - import file not found: /import.sql
INFO Feb 07 2007 03:49:45 org.hibernate.tool.hbm2ddl.SchemaExport - exporting generated schema to database
ERROR Feb 07 2007 03:49:45 org.hibernate.tool.hbm2ddl.SchemaExport - schema export unsuccessful
java.sql.SQLException: com.mchange.v2.c3p0.PoolBackedDataSource@24a8e5c0 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@c903c053 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge1397k16tgk661tcbuh5|146b6db, idleConnectionTestPeriod -> 300, initialPoolSize -> 10, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 100, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@da490ca9 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hge1397k16tgk661tcbuh5|c792d4, jdbcUrl -> jdbc:mysql://localhost/transpacifictest, properties -> {user=******, password=******, autocommit=false} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hge1397k16tgk661tcbuh5|6c5482, numHelperThreads -> 3 ] has been closed() -- you can no longer use it.
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:56)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:27)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:143)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:810)
....

Name and version of the database you are using: MySQL 4.1.22


Debug level Hibernate log excerpt: DEBUG, INFO


Top
 Profile  
 
 Post subject: exception while closing sessoinfactory when using c3po
PostPosted: Wed Feb 07, 2007 4:20 am 
Beginner
Beginner

Joined: Wed Nov 15, 2006 4:25 am
Posts: 21
Hai

After seeing your log, I am guessing that the error is in the hibernat.hb2dll.auto which is throwing an exception so try to comment that line in hibernate.cfg.xml and run once and see.Actually i never tried with c3po .


Please let me know whether it has helped you or not.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 7:06 am 
Newbie

Joined: Wed Oct 18, 2006 1:32 am
Posts: 3
When hibernate.hbm2ddl.auto is set to "create", "update" or "verify", it will not throw exception when closing the SessionFactory.

Only when set to "create-drop" it will generate the exception.

Also when c3p0 is disabled, there will be no exception


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 09, 2007 4:21 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
This looks like a recrudescence of an old (resolved) issue, whereby schema update code close()ed ConnectionProviders out from under applications. [ See http://forum.hibernate.org/viewtopic.php?t=955212 ] In your case, you're already in SessionFactory.close(), so close()ing the ConnectionProvider associated with that factory seems reasonable, but it looks like the ConnectionProvider is close()ed prior to the table drop when create-drop is set.

This sort of error might not show up with unpooled ConnectionProviders, because destroying an unpooled ConnectionProvider can be implemented as a no-op. But with a c3p0-based ConnectionProvider, close() is not a no-op; it invalidates the internal c3p0 DataSource. So if the ConnectionProvider is close()ed prior to the attempt to drop schema, it may work in the unpooled case, but fail with c3p0.

This is just a guess, though. I haven't checked hibernate source to verify.

Good luck!


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.