連線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]]>