MySQL8-[问题解决]java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying
对应为MySQL8和 MySQL-connecter8.0.16
1、修改MySQL驱动器
原来的版本:
com.mysql.jdbc.Driver
现在改为:
com.mysql.cj.jdbc.Driver
否则会告警:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2、修改连接MySQL的URL
原来的低版本是:
jdbc:mysql://localhost:3306/db_career?autoReconnect=true&useSSL=false&characterEncoding=utf-8
现在改为:
jdbc:mysql://localhost:3306/db_career?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
否则报错:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at RdsConcurrencyTest.getConn(RdsConcurrencyTest.java:21)
at RdsConcurrencyTest.main(RdsConcurrencyTest.java:57)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:361)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1452)
at com.mysql.cj.NativeSession.connect(NativeSession.java:165)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
... 7 more
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:101)
at sun.security.ssl.TransportContext.kickstart(TransportContext.java:238)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:373)
at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316)
at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:352)
... 14 more
Exception in thread "main" java.lang.NullPointerException
at RdsConcurrencyTest.main(RdsConcurrencyTest.java:61)
MySQL8-[问题解决]java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying的更多相关文章
- springBoot2.x启动项目报java.sql.SQLNonTransientConnectionException
将项目从springBoot1.x升级到springBoot2.x,启动报错: java.sql.SQLNonTransientConnectionException: Cannot load con ...
- Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';characterEncoding=UTF
今天在使用springboot整合SSM的时候,配置好以后启动项目,报了一个这样的异常 java.sql.SQLNonTransientConnectionException: Cannot load ...
- springboot启动提示连接mysql报错:java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required
如题,启动springboot报错: -- :: --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized wi ...
- java.sql.SQLException: Io 异常: Connection reset
当数据库连接池中的连接被创建而长时间不使用的情况下,该连接会自动回收并失效,但客户端并不知道,在进行数据库操作时仍然使用的是无效的数据库连接,这样,就导致客户端程序报“ java.sql.SQLExc ...
- java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)(ERR=12505)(ERR
dbc 链接orcal出错 java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)( ...
- spring+ibatis问题1—— 程序报错:java.sql.SQLException: Io 异常: Connection reset by peer, socket write error; ”或“java.sql.SQLException 关闭的连接”异常
转自:http://blog.sina.com.cn/s/blog_1549fb0710102whz2.html spring+ibatis程序测试时报错:java.sql.SQLException: ...
- Springboot:java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required
参考解决网址:https://www.cnblogs.com/studyDetail/p/7017911.html,谢谢. 数据库查询时报错:java.sql.SQLNonTransientConne ...
- [ORACLE]java.sql.SQLRecoverableException: IO Error: Connection rese
随机数引起的阻塞问题 程序通过 java -jar -Djava.security.egd=file:/dev/./urandom xxx 的方式执行, http://hongjiang.info/j ...
- 在linux上通过JDBC连接ORACLE 时总是出现 java.sql.SQLRecoverableException: IO Error: Connection reset 的问题
如标题所述,经过和度娘沟通了不知道多少遍最后看一篇文章解决, 我是通过执行jar来操作DB的.所以在命令中加了一个参数( 加粗,红色) eg: $JAVA_EXE -Djava.security.eg ...
- mysql遇到java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
在连接数据库的url中,加上allowPublicKeyRetrieval=true from:https://blog.csdn.net/Gushiyuta/article/details/9323 ...
随机推荐
- SpringBoot AOP 记录操作日志、异常日志
使用SpringBoot AOP 记录操作日志.异常日志 我们在做项目时经常需要对一些重要功能操作记录日志,方便以后跟踪是谁在操作此功能.在操作某些功能时也有可能会发生异常,但是每次发生异常要定位原因 ...
- python · pytorch | NN 训练常用代码存档
1 pandas 读 csv import torch from torch import nn import numpy as np import pandas as pd from copy im ...
- kafka 性能优化与常见问题优化处理方案
本文为博主原创,未经允许不得转载: 1. JVM参数优化设置 kafka是scala语言开发,运行在JVM上,需要对JVM参数合理设置,修改bin/kafka-start-server.sh中的jv ...
- SV interface and Program3
时钟域的理解 在仿真过程中,时钟跳变的一瞬间,CPU将时间域划分为不同的时钟域执行不同的代码 信号在芯片中都是金属丝,在进行跳变的时候都是电容的充放电过程,通常使用时钟上升沿进行模拟,而不使用时钟下降 ...
- steam无法登陆/更新客户端
1.问题 最近CS2更新,正准备尝试游玩一下,发现提示要使用最新版本客户端,在检查steam客户端更新时,却发现检查更新失败,无法更新,有可能是丢失了某些文件导致的. (之前有过一次重新安装的经历,但 ...
- Python学习之十八_获取神通数据库所有的表数据量
Python学习之十八_获取神通数据库所有的表数据量 背景 今天想获取一下所有数据库的表信息.但是发现神通数据库的系统表里面的表信息不正确 无法获取实际意义的表信息. 联系了下神通数据库的原厂高手. ...
- Rsync原理的学习与总结
Rsync原理的简单学习 前言 工作这么多年, 感觉对自己帮助最大的是rsync. 用了很多rsync的脚本, 甚至因为这个脚本授权了两个专利. 但是昨天晚上在跟高手聊天时发现 自己对rsync 其实 ...
- [转帖]SPEC2006
安装步骤 # Ubuntu16.04 # 注意安装gFortran . ./install.sh . ./shrc 一般情况下经过以上步骤即可安装完毕,进行使用,注意需要执行shrc设置完环境变量以后 ...
- [转帖]010 Linux 文本统计与去重 (wc 和 uniq)
https://my.oschina.net/u/3113381/blog/5427461 wc 命令一般是作为组合命令的一员与其他命令一同起到统计的作用.而一般情况下使用 wc -l 命令较多. u ...
- [转帖]SPECjvm测试工具详解
ARM服务器测试大纲中指定了要使用specjvm测试Java虚拟机性能,所以就上网找开源的测试套. 简介 SPECjvm2008(java虚拟机基准测试)是用来测试java运行环境(JRE)性能的基准 ...