CannotGetJdbcConnectionException:Failed to obtain JDBC Connection

异常如下:


 
 
  1. Exception in thread "pool-3-thread-2" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
  2. ### Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  3. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  4. ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  5. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  6. at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java: 77)
  7. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java: 446)
  8. at com.sun.proxy.$Proxy59.insert(Unknown Source)
  9. at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java: 278)
  10. at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java: 58)
  11. at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java: 59)
  12. at com.sun.proxy.$Proxy68.insertSelectiveList(Unknown Source)
  13. at com.gwd.movie.service.impl.AnalyzeMovieHtmlServiceImpl.getView(AnalyzeMovieHtmlServiceImpl.java: 111)
  14. at com.gwd.movie.service.impl.AnalyzeMovieHtmlServiceImpl.getDoc(AnalyzeMovieHtmlServiceImpl.java: 127)
  15. at com.gwd.movie.service.impl.AnalyzeMovieHtmlServiceImpl.getTitleDetailUrl(AnalyzeMovieHtmlServiceImpl.java: 214)
  16. at com.gwd.movie.service.impl.AnalyzeMovieHtmlServiceImpl$ 1.run(AnalyzeMovieHtmlServiceImpl.java: 189)
  17. at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  18. at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  19. at java.lang.Thread.run(Unknown Source)
  20. Caused by: org.apache.ibatis.exceptions.PersistenceException:
  21. ### Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  22. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  23. ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  24. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  25. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java: 30)
  26. at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java: 200)
  27. at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java: 185)
  28. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  29. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  30. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  31. at java.lang.reflect.Method.invoke(Unknown Source)
  32. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java: 433)
  33. ... 12 more
  34. Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  35. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  36. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java: 81)
  37. at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java: 82)
  38. at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java: 68)
  39. at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java: 338)
  40. at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java: 84)
  41. at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java: 49)
  42. at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java: 117)
  43. at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java: 76)
  44. at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java: 198)
  45. ... 18 more
  46. Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  47. The last packet successfully received from the server was 1, 610 milliseconds ago. The last packet sent successfully to the server was 1, 583 milliseconds ago.
  48. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  49. at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  50. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  51. at java.lang.reflect.Constructor.newInstance(Unknown Source)
  52. at com.mysql.jdbc.Util.handleNewInstance(Util.java: 425)
  53. at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java: 990)
  54. at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java: 201)
  55. at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java: 4914)
  56. at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java: 1663)
  57. at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java: 1224)
  58. at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java: 2199)
  59. at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java: 2230)
  60. at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java: 2025)
  61. at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java: 778)
  62. at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java: 47)
  63. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  64. at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  65. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  66. at java.lang.reflect.Constructor.newInstance(Unknown Source)
  67. at com.mysql.jdbc.Util.handleNewInstance(Util.java: 425)
  68. at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java: 386)
  69. at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java: 330)
  70. at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java: 1408)
  71. at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java: 1464)
  72. at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java: 684)
  73. at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java: 991)
  74. at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java: 987)
  75. at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java: 103)
  76. at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java: 151)
  77. at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java: 115)
  78. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java: 78)
  79. ... 26 more
  80. Caused by: javax.net.ssl.SSLException: java.lang.SecurityException: JCE cannot authenticate the provider SunJCE
  81. at sun.security.ssl.Alerts.getSSLException(Unknown Source)
  82. at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
  83. at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
  84. at sun.security.ssl.SSLSocketImpl.handleException(Unknown Source)
  85. at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
  86. at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
  87. at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java: 186)
  88. ... 50 more
  89. Caused by: java.lang.SecurityException: JCE cannot authenticate the provider SunJCE
  90. at javax.crypto.Cipher.getInstance(Cipher.java: 657)
  91. at java.security.Signature$Delegate.newInstance(Unknown Source)
  92. at java.security.Signature$Delegate.chooseProvider(Unknown Source)
  93. at java.security.Signature$Delegate.engineInitVerify(Unknown Source)
  94. at java.security.Signature.initVerify(Unknown Source)
  95. at sun.security.ssl.RSASignature.engineInitVerify(Unknown Source)
  96. at java.security.Signature$Delegate.init(Unknown Source)
  97. at java.security.Signature$Delegate.chooseProvider(Unknown Source)
  98. at java.security.Signature$Delegate.engineInitVerify(Unknown Source)
  99. at java.security.Signature.initVerify(Unknown Source)
  100. at sun.security.ssl.HandshakeMessage$DH_ServerKeyExchange.<init>(Unknown Source)
  101. at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
  102. at sun.security.ssl.Handshaker.processLoop(Unknown Source)
  103. at sun.security.ssl.Handshaker.process_record(Unknown Source)
  104. at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
  105. at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
  106. ... 53 more
  107. Caused by: java.util.jar.JarException: Class is on the bootclasspath
  108. at javax.crypto.JarVerifier.verify(JarVerifier.java: 286)
  109. at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java: 164)
  110. at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java: 190)
  111. at javax.crypto.Cipher.getInstance(Cipher.java: 653)
  112. ... 68 more
  113. Sun Oct 21 16: 25: 41 CST 2018 WARN: Establishing SSL connection without serve r's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  114. Sun Oct 21 16: 25: 42 CST 2018 WARN: Establishing SSL connection without serve r's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  115. Sun Oct 21 16: 25: 42 CST 2018 WARN: Establishing SSL connection without serve r's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  116. Sun Oct 21 16: 25: 42 CST 2018 WARN: Establishing SSL connection without serve r's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

 

解决方案:

spring.datasource.url=jdbc:mysql://xx.xx.xx.xx/XX?characterEncoding=UTF-8
 
 

加上&useSSL=false

spring.datasource.url=jdbc:mysql:/xx.xx.xx.xx/XX?characterEncoding=UTF-8&useSSL=false

 
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值