Data source rejected establishment of connection, message from server: "Too many connections"
出现这个错误,是因为连接数 大于 mysql的最大连接数,可通过修改配置文件来增大Mysql的最大连接数。
1 com.mchange.v2.resourcepool.BasicResourcePool(line/:1841) - 2 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@186e1f5a -- 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: 3 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections" 4 at sun.reflect.GeneratedConstructorAccessor11.newInstance(Unknown Source) 5 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 6 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 7 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 8 at com.mysql.jdbc.Util.getInstance(Util.java:386) 9 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013) 10 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) 11 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) 12 at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1136) 13 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2395) 14 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428) 15 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213) 16 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797) 17 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 18 at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source) 19 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 20 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 21 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 22 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) 23 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) 24 at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) 25 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) 26 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) 27 at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 28 at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) 29 at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) 30 at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) 31 at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)