原来在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.
请多多指教。
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.
请多多指教。
解决方案 »
- SSH框架在整合Struts2和spring有,项目运行控制台不报错,但页面出现404,这是什么情况啊
- 二维数组求方差问题?
- java如何进行不定项查询
- 简单几道J2EE题目,,,哪位牛人看看先...
- 请问学习JAVA电脑最好要怎么配置?
- 弱弱地问一声:发布已存在的webservice是不是只需要将生成的server-config.wsdd文件拷贝到相关应用的WEB-INF目录下面即可,别的什么都不
- Hibernate:many-to-one问题,最好有实例,解决了重新开贴加倍给分(晚上结贴)
- 簡單問題,幫忙看一看 謝謝
- struts的错误,
- webshpere中如何设置
- js 提交action
- hibernate联合主键(其中有一个是外键)
数据库服务开了。
数据库连接出现了问题,问题很有可能是以下几个:
你使用的是不是jndi,连接池跟tomcat有关,你是不是没有配置应用跟tomcat?
在数据库那边,你检查一下,用其他程序能不能连接到数据库。
主要应该不是tomcat的问题,我怀疑是你tomcat的配置出什么问题了,你试下用这个tomcat,跟其他应用看看可以一起使用不。
Tomcat\lib 下面没有 JDBC驱动包
拷一个JDBC驱动包到Tomcat\lib 下面
问题 就应该解决了
所以我判断跟用户名密码和数据库驱动是否正常没有太大关系。跟tomcat也没有关系。
因为,我没有用tomcat.报的错误是相同的。
我的判断是,可能是连接的释放问题,或连接权限问题。
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.beginTransaction(Unknown Source)
at com.kettas.util.HibernateUtil.beginTransaction(HibernateUtil.java:17)
at com.kettas.biz.impl.UserBizImpl.insertUser(UserBizImpl.java:27)
at com.kettas.util.TestUserBiz.main(TestUserBiz.java:16)
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:56)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 13 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)
... 16 more
你的连接池和你tomcat有关
你原来的连接池里面的连接没有释放掉
造成的无法获取
可以把VO里面的类型改为Long,就可以了