Org.springframework.transaction.CannotCreateTransactionException:Could not open JDBC Connection for transaction; Nested exception is java.sql.SQLException:Cannot create Poolableconnectionfactory (Could don't create connection to Databas E server. Attempted reconnect 3 times. Giving up.)
At Org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin (Datasourcetransactionmanager.java : 245)
At Org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction ( abstractplatformtransactionmanager.java:373)
At Org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary ( transactionaspectsupport.java:427)
At Org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction ( transactionaspectsupport.java:276)
At Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:96)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:179)
At Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (exposeinvocationinterceptor.java:92)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:179)
At Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (jdkdynamicaopproxy.java:208)
At $Proxy 27.insertOneSysConfigLog (Unknown Source)
At Com.dream.common.util.JunitTest.test (junittest.java:41)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:601)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:50)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:47)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:17)
At Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:325)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:290)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:58)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268)
At Org.junit.runners.ParentRunner.run (parentrunner.java:363)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:86)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:459)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:675)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:382)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:192)
caused By:java.sql.SQLException:Cannot create poolableconnectionfactory (Could not the Create connection to database server. Attempted reconnect 3 times. Giving up.)
At Org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory (basicdatasource.java:2294)
At Org.apache.commons.dbcp2.BasicDataSource.createDataSource (basicdatasource.java:2039)
At Org.apache.commons.dbcp2.BasicDataSource.getConnection (basicdatasource.java:1533)
At Org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin (Datasourcetransactionmanager.java : 204)
... More
caused by:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Could not create connection to Database server. Attempted reconnect 3 times. Giving up.
At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:57)
At Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:45)
At Java.lang.reflect.Constructor.newInstance (constructor.java:525)
At Com.mysql.jdbc.Util.handleNewInstance (util.java:404)
At Com.mysql.jdbc.Util.getInstance (util.java:387)
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:917)
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:896)
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:885)
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:860)
At Com.mysql.jdbc.ConnectionImpl.connectWithRetries (connectionimpl.java:2165)
At Com.mysql.jdbc.ConnectionImpl.createNewIO (connectionimpl.java:2090)
At Com.mysql.jdbc.connectionimpl.<init> (connectionimpl.java:795)
At Com.mysql.jdbc.jdbc4connection.<init> (jdbc4connection.java:44)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:57)
At Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:45)
At Java.lang.reflect.Constructor.newInstance (constructor.java:525)
At Com.mysql.jdbc.Util.handleNewInstance (util.java:404)
At Com.mysql.jdbc.ConnectionImpl.getInstance (connectionimpl.java:400)
At Com.mysql.jdbc.NonRegisteringDriver.connect (nonregisteringdriver.java:327)
At Org.apache.commons.dbcp2.DriverConnectionFactory.createConnection (driverconnectionfactory.java:39)
At Org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject (poolableconnectionfactory.java:256)
At Org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory (basicdatasource.java:2304)
At Org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory (basicdatasource.java:2290)
... More
caused by:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure
The last packet successfully received from the server was 2 milliseconds ago. The last packet sent successfully to the server was 2 milliseconds ago.
At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:57)
At Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:45)
At Java.lang.reflect.Constructor.newInstance (constructor.java:525)
At Com.mysql.jdbc.Util.handleNewInstance (util.java:404)
At Com.mysql.jdbc.SQLError.createCommunicationsException (sqlerror.java:981)
At Com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket (exportcontrolled.java:164)
At Com.mysql.jdbc.MysqlIO.negotiateSSLConnection (mysqlio.java:4801)
At Com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication (mysqlio.java:1643)
At Com.mysql.jdbc.MysqlIO.doHandshake (mysqlio.java:1215)
At Com.mysql.jdbc.ConnectionImpl.coreConnect (connectionimpl.java:2255)
At Com.mysql.jdbc.ConnectionImpl.connectWithRetries (connectionimpl.java:2106)
... More
caused by:javax.net.ssl.SSLException:Unsupported record version Unknown-0.0
At Sun.security.ssl.InputRecord.readV3Record (inputrecord.java:394)
At Sun.security.ssl.InputRecord.read (inputrecord.java:376)
At Sun.security.ssl.SSLSocketImpl.readRecord (sslsocketimpl.java:927)
At Sun.security.ssl.SSLSocketImpl.performInitialHandshake (sslsocketimpl.java:1328)
At Sun.security.ssl.SSLSocketImpl.startHandshake (sslsocketimpl.java:1355)
At Sun.security.ssl.SSLSocketImpl.startHandshake (sslsocketimpl.java:1339)
At Com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket (exportcontrolled.java:149)
... More
----------we focus on the Red font section, it's obviously due to SSL
My MySQL version is 5.7, the newly installed, not with MySQL SSL, but the connection pool link when the default encryption, so has not been connected, the solution is as follows:
url=jdbc:mysql://192.168.80.128:3301/dream?useunicode=true&characterencoding=utf-8&usessl=false& Autoreconnect=true&failoverreadonly=false
When configuring the JDBC link string, add the &usessl=false, do not use SSL encryption, the configuration after the connection is normal, if the high security data suggested on the MySQL side or the SSL match.
The database operation is reported through the DBCP link pool cannot create poolableconnectionfactory (Could not the Create connection to databases server. Attempted reconnect 3 times. Giving up.) --Solutions