代码改变世界

连接mysql数据库报:javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify

2021-08-07 10:21  猎手家园  阅读(406)  评论(0编辑  收藏  举报

连接mysql数据库报错:

** BEGIN NESTED EXCEPTION ** 

javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer's close_notify

STACKTRACE:

javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
    at sun.security.ssl.Alert.createSSLException(Alert.java:133)
    at sun.security.ssl.Alert.createSSLException(Alert.java:117)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:314)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:270)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:261)
    at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:656)
    at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:635)
    at com.mysql.cj.mysqla.io.MysqlaProtocol.quit(MysqlaProtocol.java:1282)
    at com.mysql.cj.mysqla.MysqlaSession.quit(MysqlaSession.java:224)
    at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:3239)
    at com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:1113)
    at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:73)
    at com.alibaba.druid.pool.DruidDataSource.shrink(DruidDataSource.java:2833)
    at com.alibaba.druid.pool.DruidDataSource$DestroyTask.run(DruidDataSource.java:2598)
    at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2585)

** END NESTED EXCEPTION **

 

解决办法:在连接字符串最后加“useSSL=false

如下:

<![CDATA[jdbc:mysql://127.0.0.1:3306/yourdatabase?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false]]>

 

欢迎关注我的公众号:云栖语,不一样的研发视界。
云栖语微信公众号:change-1978