SSLException: closing inbound before receiving peer’s close_notify

Tags: , ,



I’m writing a simple JDBC code with MySQL. Everything works fine and I’m able to print the records in table through select statement. But when I’m closing the connection, using Connection.close(), I’m getting the below exception. Any help is appreciated.

 WARN: Caught while disconnecting...
EXCEPTION STACK TRACE:
** 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 java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
    at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
    at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
    at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
    at com.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1312)
    at com.mysql.cj.NativeSession.quit(NativeSession.java:182)
    at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1750)
    at com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:720)
    at com.jdbc.Driver.display(Driver.java:27)
    at com.jdbc.Driver.main(Driver.java:38)

Answer

This was a issue with the MySQL driver on Java 11 https://bugs.mysql.com/bug.php?id=93590

This has been fixed in Connector/J version 8.0.16



Source: stackoverflow