我原来用的是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的包就出上面的错误。
我的配置如下:
实在是不明白这两个版本的hibernate为什么会造成这种情况,不知道大家有没有出现过这种情况,怎么解决这个问题呢???
问题已解决,谢谢大家!
产生的问题是因为没有配置hibernate.cache.provider_class,很奇怪的问题,在3.1.3版本中缓存提供类并非必须的。而在3.2版本中,则必须配置才可以正常创建连接池。
:) 万分感谢楼下各位的热心!!