问题描述
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)atorg.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)atorg.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)atjava.lang.Thread.run(UnknownSource)Causedby:com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:Toomanyconnectionsatcom.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)atcom.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)atcom.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)atcom.mysql.jdbc.Connection.createNewIO(Connection.java:2670)atcom.mysql.jdbc.Connection.<init>(Connection.java:1531)atcom.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)atorg.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)atorg.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)atorg.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)atorg.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74)atorg.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)atorg.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)atorg.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)atorg.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)...46more[WARN]2010-04-2916:07:24,096org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:77)SQLError:1040,SQLState:08004[ERROR]2010-04-2916:07:24,098org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)Toomanyconnections[WARN]2010-04-2916:07:24,100org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:77)SQLError:1040,SQLState:08004[ERROR]2010-04-2916:07:24,101org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)Toomanyconnectionsorg.hibernate.exception.JDBCConnectionException:Cannotopenconnectionatorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)atorg.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)atorg.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)atorg.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)atorg.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)atorg.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)atorg.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)atorg.hibernate.loader.Loader.doQuery(Loader.java:673)atorg.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)atorg.hibernate.loader.Loader.doList(Loader.java:2220)atorg.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)atorg.hibernate.loader.Loader.list(Loader.java:2099)atorg.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)atorg.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)atorg.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)atorg.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)atorg.hibernate.impl.QueryImpl.list(QueryImpl.java:79)atnet.mappan.EbusinessManager.dao.impl.LoginLogDaoImpl.checkLoginUserNameExists(LoginLogDaoImpl.java:101)atnet.mappan.EbusinessManager.biz.impl.LoginLogBizImpl.checkLoginUserNameExists(LoginLogBizImpl.java:37)atnet.mappan.EbusinessManager.web.action.UserAction.login(UserAction.java:75)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource))org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)atorg.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)atorg.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)atjava.lang.Thread.run(UnknownSource)Causedby:com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:Toomanyconnections
解决方案
解决方案二:
嗯嗯,很多地方开了连接没close。然后就org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)Toomanyconnectionsorg.hibernate.exception.JDBCConnectionException:Cannotopenconnection
解决方案三:
楼主是如何控制事务的?
解决方案四:
手动的不然也不会没关了--!
解决方案五:
session在finally里关掉