原来在Tomcat里测试都是好好的,后来重新装了下Tomcat,测试就出错了。
log文件部分内容如下:
>>>>>>>LOG4J<<<<<<< 0 2009-04-27 17:54:49,328 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 1000 2009-04-27 17:54:50,328 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 1000 2009-04-27 17:54:50,328 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - could not get database metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:264)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:972)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:260)
... 52 more
>>>>>>>LOG4J<<<<<<< 1093 2009-04-27 17:54:50,421 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:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:264)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
... 52 more
>>>>>>>LOG4J<<<<<<< 29156 2009-04-27 17:55:18,484 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 29172 2009-04-27 17:55:18,500 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 90312 2009-04-27 17:56:19,640 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 90312 2009-04-27 17:56:19,640 ERROR [org.hibernate.util.JDBCExceptionReporter] - Connections could not be acquired from the underlying database!
>>>>>>>LOG4J<<<<<<< 90312 2009-04-27 17:56:19,640 ERROR [org.hibernate.util.JDBCExceptionReporter] - An SQLException was provoked by the following failure: com.mchange.v2.resourcepool.ResourcePoolException: A ResourcePool cannot acquire a new resource -- the factory or source appears to be down.
>>>>>>>LOG4J<<<<<<< 90312 2009-04-27 17:56:19,640 ERROR [org.hibernate.util.JDBCExceptionReporter] - An SQLException was provoked by the following failure: com.mchange.v2.resourcepool.ResourcePoolException: A ResourcePool cannot acquire a new resource -- the factory or source appears to be down.
请多多指教。
------解决方案--------------------
你有把所有JAR都放进去吗,还有数据库服务开了没?
------解决方案--------------------
Connections could not be acquired from the underlying database!
数据库连接出现了问题,问题很有可能是以下几个:
你使用的是不是jndi,连接池跟tomcat有关,你是不是没有配置应用跟tomcat?
在数据库那边,你检查一下,用其他程序能不能连接到数据库。
主要应该不是tomcat的问题,我怀疑是你tomcat的配置出什么问题了,你试下用这个tomcat,跟其他应用看看可以一起使用不。
------解决方案--------------------
很明显,链接数据库错误。请检查链接的URl参数、用户名密码和数据库驱动是否正常。可以先去掉连接池试一下。