一、异常
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60010, active 20, maxActive 20
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:280)
... 64 more
Caused by: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60010, active 20, maxActive 20
at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1071)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:898)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4544)
二、原因
Druid数据库连接池的数据库获取连接超时。
原druid中设置的 maxActive为20,maxWait为60000。
实际wait millis 60010, active 20。活动的连接数用完了,在等待新的连接,却没有新连接可用,导致超时。
三、解决
将application.yml文件中url的配置:useSSL=true 改为:useSSL=false。