今天升级hibernate3.2GA遇到一个很奇怪的问题(谢谢大家,已解决)

阅读更多
今天看到hibernate3.2ga版出来,赶紧更新。

我原来用的是hibernate3.1.3版本+Spring2.0,结果更新后,我配置的c3p0连接池是死活也连接不上了。

数据库是mysql,它在那里一直"Building new Hibernate SessionFactory".

一口气创建了好多。输出信息是这样的:

....-Building new Hibernate SessionFactory
....-Building new Hibernate SessionFactory
....-Building new Hibernate SessionFactory
....-Building new Hibernate SessionFactory
....-Building new Hibernate SessionFactory

然后报错:

WARN  com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@16528a2 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
2006-10-18 02:07:03,125 [main] WARN  org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!


把jar包换成hibernate3.1.3.jar就完全正常,用hibernate3.2GA的包就出上面的错误。


我的配置如下:




/domain/Admin.hbm.xml





${hibernate.connection.driver_class}
${hibernate.connection.url}
${hibernate.connection.username}
${hibernate.connection.password}
${hibernate.useUnicode}
${hibernate.characterEncoding}
${hibernate.autoReconnect}
${hibernate.dialect}
${hibernate.show_sql}
${hibernate.default-lazy-init}
${hibernate.connection.provider_class}

${hibernate.c3p0.max_size}
${hibernate.c3p0.min_size}
${hibernate.c3p0.timeout}
${hibernate.c3p0.max_statements}
${hibernate.c3p0.idle_test_period}
${hibernate.c3p0.acquire_increment}
${hibernate.c3p0.validate}






实在是不明白这两个版本的hibernate为什么会造成这种情况,不知道大家有没有出现过这种情况,怎么解决这个问题呢???




问题已解决,谢谢大家!

产生的问题是因为没有配置hibernate.cache.provider_class,很奇怪的问题,在3.1.3版本中缓存提供类并非必须的。而在3.2版本中,则必须配置才可以正常创建连接池。

:) 万分感谢楼下各位的热心!!

你可能感兴趣的:(Hibernate,MySQL,Cache,Spring,OpenSource)