WGCLOUD监控sqlserver报错javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10

时间:2022-10-18 08:58:10
Caused by: javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10 is not accepted by client preferences [TLS12]
at sun.security.ssl.Alert.createSSLException(Alert.java:131)
at sun.security.ssl.Alert.createSSLException(Alert.java:117)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:311)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
at sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:943)
at sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:869)
at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
at sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1397)
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1305)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1618)
... 35 common frames omitted

原因描述:SqlServer 服务器只接受 TLS1.0,但是客户端给的是 TLS1.2

解决方法如下:

打开文件:JAVA_HOME\jre\lib\security\java.security,搜索关键词jdk.tls

可以找到配置项:jdk.tls.disabledAlgorithms(jdk不生效的算法配置)里面有TLSv1, 也就是说 TSL1.0版本不让用了,这样就解释了为啥会出现问题

WGCLOUD监控sqlserver报错javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10

以下三种解决方法,任选其一即可

  1. 把 jdk.tls.disabledAlgorithms 配置项中 TLSv1 删除,这样 TLS1.0 就可以使用了
  2. 把 jdk.tls.disabledAlgorithms 配置项注释掉或者删掉
  3. 如果嫌麻烦可以直接把 java.security 文件删了,问题可以解决,但是会不会出现其他问题就不得而知了,慎重使用 原文链接:https://blog.csdn.net/xiaoshuaideboke/article/details/127370028