The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unexpected rethrowing"

Solution Verified - Updated -

Issue

While doing test-connection in the Microsoft SQL datasources, it is failing and the following ERROR log is showing in the JBoss EAP server log:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unexpected rethrowing".
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2892)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1881)
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2452)
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2103)
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1950)
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1162)
        at com.microsoft//com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:735)
        at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:335)
        ... 38 more
Caused by: javax.net.ssl.SSLException: Unexpected rethrowing
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:332)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:298)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:145)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1511)
        at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1799)
        ... 44 more
Caused by: java.io.IOException: SQL Server did not return a response. The connection has been closed. ClientConnectionId:bb98921b-21f7-43fc-xxxxxx-xxxxxxx
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.ensureSSLPayload(IOBuffer.java:790)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.readInternal(IOBuffer.java:840)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.read(IOBuffer.java:833)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1003)
        at com.microsoft//com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:993)
        at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
        at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
        at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
        ... 49 more

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7
  • Microsoft SQL Server

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content