com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection

Occasional Visitor

I am trying to connect sql database using mssql-jdbc-11.2.0.jre8.jar and facing connectivity issue and if i try with sqljdbc42.jar then it is connecting. i have attached the stack trace which i got during the failure. could you please guide me how to resolve this error.

 

2022-10-06 16:31:24 [t=ServerService Thread Pool -- 102,p=413] ERROR [RESOURCELOGGER] uuId="24e11272d4b24094ad1a97fe3466a6bf",dim="A",level="ERROR",comp="TEMN-null-RESOURCELOGGER",cn="com.temenos.resourceserver.utils.ResourceLogger:logAlert:170",exception="The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: 'Unexpected rethrowing'.",msg="Could not initialise DB pool for tenant SYSTEM"
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.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3806) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1906) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3329) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1064) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_345]
at java.sql.DriverManager.getConnection(DriverManager.java:247) ~[?:1.8.0_345]
at com.temenos.resourceserver.database.DBConnection.createDBConnection(DBConnection.java:116) ~[classes:?]
at com.temenos.resourceserver.utils.ResourceServerHelper.createDBConnection(ResourceServerHelper.java:174) ~[classes:?]
at com.temenos.resourceserver.utils.ResourceServerHelper.initialiseTenantDBPool(ResourceServerHelper.java:250) ~[classes:?]
at com.temenos.resourceserver.utils.ResourceServerHelper.initialiseDBPool(ResourceServerHelper.java:234) ~[classes:?]
at com.temenos.resourceserver.ResourceServer.init(ResourceServer.java:98) ~[classes:?]
at javax.servlet.GenericServlet.init(GenericServlet.java:180) ~[jboss-servlet-api_4.0_spec-2.0.0.Final.jar!/:2.0.0.Final]
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78) ~[?:?]
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:305) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:145) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:588) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:559) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) ~[?:?]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) ~[?:?]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) ~[?:?]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) ~[?:?]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) ~[?:?]
at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:601) ~[undertow-servlet-2.2.5.Final.jar!/:2.2.5.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:97) ~[?:?]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_345]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_345]
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) ~[?:?]
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) ~[?:?]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) ~[?:?]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) ~[?:?]
at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_345]
at org.jboss.threads.JBossThread.run(JBossThread.java:513) ~[?:?]
Caused by: javax.net.ssl.SSLException: Unexpected rethrowing
at sun.security.ssl.Alert.createSSLException(Alert.java:127) ~[?:1.8.0_345]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:296) ~[?:1.8.0_345]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:267) ~[?:1.8.0_345]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:262) ~[?:1.8.0_345]
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:138) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1397) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1305) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) ~[?:1.8.0_345]
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1795) ~[mssql-jdbc-11.2.0.jre8.jar:?]
... 38 more
Caused by: java.io.IOException: Connection reset ClientConnectionId:02e227cd-3d16-4485-8d84-250f56e15637
at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.ensureSSLPayload(IOBuffer.java:908) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.readInternal(IOBuffer.java:968) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.read(IOBuffer.java:961) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1207) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1194) ~[mssql-jdbc-11.2.0.jre8.jar:?]
at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:165) ~[?:1.8.0_345]
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1397) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1305) ~[?:1.8.0_345]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) ~[?:1.8.0_345]
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1795) ~[mssql-jdbc-11.2.0.jre8.jar:?]
... 38 more

0 Replies