tomcat,hibernate,mysql连接问题

时间:2011-12-06 01:06:18

标签: mysql hibernate tomcat

我的应用程序上出现以下错误。涉及的技术是Sturts,hibernate,mysql,tomcat。奇怪的是,应用程序冻结通常需要几天时间,这就是tomcat和mysql服务仍然可用,但是无法加载对我来说没有意义的网页。

有人可以给我一些解决问题的想法或指示吗?感谢。

WARN (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1) [com.mchange.v2.resourcepool.BasicResourcePool] - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1ec2ec0 -- 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). Last acquisition attempt exception: 
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:107)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:161)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:113)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:728)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1258)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:368)

1 个答案:

答案 0 :(得分:0)

最好不要使用root用户从db server以外的机器连接到数据库。我建议创建一个db用户,它可以从任何机器连接到数据库,例如'db1'@'%'(参见:http://dev.mysql.com/doc/refman/5.5/en/adding-users.html