org.apache.tomcat.jdbc.pool.ConnectionPool.init无法创建池的初始连接

时间:2017-05-24 13:58:33

标签: tomcat jdbc pool

当我使用Tomcat-jdbc连接到MySQL时,我看到以下错误。我的环境包含以下软件版本:

  • tomcat-jdbc 8.5.15
  • mysql-connector-java 6.0.6
  • mysql server 5.7.18

错误是:

SQLCODE : 0
SQLSTATE: 08001
Message : Could not create connection to database server.
org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool.
 java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:526)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1779)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:633)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310)
        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:482)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnectionAsync(DataSourceProxy.java:142)

Db池属性如下:

ConnectionPool[defaultAutoCommit=null;
defaultReadOnly=null;
defaultTransactionIsolation=-1;
defaultCatalog=null;
driverClassName=com.mysql.cj.jdbc.Driver;
maxActive=1000;
maxIdle=100;
minIdle=10;
initialSize=10;
maxWait=10000;
testOnBorrow=true;
testOnReturn=false;
timeBetweenEvictionRunsMillis=5000;
numTestsPerEvictionRun=0;
minEvictableIdleTimeMillis=30000;
testWhileIdle=false;
testOnConnect=false;
password=********;
url=jdbc:mysql://10.0.xxx.xxx:3306/xxxx?useSSL=false&useCursorFetch=true&defaultFetchSize=1000&zeroDateTimeBehavior=convertToNull;
username=sa;
validationQuery=SELECT 1;
validationQueryTimeout=60;
validatorClassName=null;
validationInterval=5000;
accessToUnderlyingConnectionAllowed=true;
removeAbandoned=true;
removeAbandonedTimeout=60;
logAbandoned=false;
connectionProperties=null;
initSQL=null
jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
jmxEnabled=true;
fairQueue=true;
useEquals=true;
abandonWhenPercentageFull=0;
maxAge=0;
useLock=false;
dataSource=null;
dataSourceJNDI=null;
suspectTimeout=0;
alternateUsernameAllowed=false;
commitOnReturn=false;
rollbackOnReturn=false;
useDisposableConnectionFacade=true;
logValidationErrors=false;
propagateInterruptState=false;
ignoreExceptionOnPreLoad=false;
useStatementFacade=true;

0 个答案:

没有答案