java.io.EOFException: SSL peer shut down incorrectly jdk1.8不支持TSLv1.3问题解决

这篇具有很好参考价值的文章主要介绍了java.io.EOFException: SSL peer shut down incorrectly jdk1.8不支持TSLv1.3问题解决。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

场景

使用ResCU(Java (JAX-RS) rest 服务框架)调用www.derbit.com 使用墙导致报错

  • 本地环境

  • jdk adoptopenjdk-8.jdk

  • 报错如下

12:09:19.321 [main] DEBUG si.mazi.rescu.HttpTemplate - Executing GET request at <https://www.deribit.com/api/v2/public/get_order_book?instrument_name=BTC-PERPETUAL>
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
	at java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1696)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1514)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1416)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:572)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:201)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
	at si.mazi.rescu.HttpTemplate.receive(HttpTemplate.java:122)
	at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:162)
	at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:119)
	at com.sun.proxy.$Proxy17.getOrderBook(Unknown Source)
	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataServiceRaw.getDeribitOrderBook(DeribitPerpetualSwapMarketDataServiceRaw.java:35)
	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataService.getOrderBook(DeribitPerpetualSwapMarketDataService.java:33)
	at org.market.hedge.deribit.swap.DeribitMarketDataTest.getDeribitOrderBookTest(DeribitMarketDataTest.java:42)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:483)
	at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
	... 41 more

排查过程

1. 启动项增加-Djavax.net.debug=SSL,handshake debug 排查

首先看到是javax.net.ssl.SSLHandshakeException ,启动项增加-Djavax.net.debug=SSL,handshake deubg 输出日志排查

  • 控制台输出如下

12:16:53.147 [main] DEBUG si.mazi.rescu.HttpTemplate - Executing GET request at <https://www.deribit.com/api/v2/public/get_order_book?instrument_name=BTC-PERPETUAL>
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.202 CST|SSLCipher.java:438|jdk.tls.keyLimits:  entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.370 CST|Utilities.java:73|the previous server name in SNI (type=host_name (0), value=www.deribit.com) was replaced with (type=host_name (0), value=www.deribit.com)
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.372 CST|HandshakeContext.java:304|No available cipher suite for TLS13
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.397 CST|SSLExtensions.java:260|Ignore, context unavailable extension: status_request
javax.net.ssl|WARNING|01|main|2023-01-07 12:16:53.402 CST|SignatureScheme.java:297|Signature algorithm, ed25519, is not supported by the underlying providers
javax.net.ssl|WARNING|01|main|2023-01-07 12:16:53.402 CST|SignatureScheme.java:297|Signature algorithm, ed448, is not supported by the underlying providers
javax.net.ssl|INFO|01|main|2023-01-07 12:16:53.408 CST|AlpnExtension.java:161|No available application protocols
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.408 CST|SSLExtensions.java:260|Ignore, context unavailable extension: application_layer_protocol_negotiation
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.408 CST|SSLExtensions.java:260|Ignore, context unavailable extension: status_request_v2
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.408 CST|SSLExtensions.java:260|Ignore, context unavailable extension: renegotiation_info
javax.net.ssl|FINE|01|main|2023-01-07 12:16:53.410 CST|ClientHello.java:575|Produced ClientHello handshake message (
"ClientHello": {
  "client version"      : "TLSv1.2",
  "random"              : "50 BA 4B 6E DF 0A ED 79 36 C8 DE 59 66 C1 4D 06 00 0C 9E CF 91 82 28 49 4C A2 BF 60 26 E2 6A 9C",
  "session id"          : "",
  "cipher suites"       : "[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(0xC02C), TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(0xC02B), TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(0xC030), TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D), TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(0xC02E), TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(0xC032), TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(0x009F), TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(0x00A3), TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(0xC02F), TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C), TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(0xC02D), TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(0xC031), TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(0x009E), TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(0x00A2), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(0xC024), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(0xC028), TLS_RSA_WITH_AES_256_CBC_SHA256(0x003D), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(0xC026), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(0xC02A), TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(0x006B), TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(0x006A), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(0xC00A), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(0xC014), TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(0xC005), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(0xC00F), TLS_DHE_RSA_WITH_AES_256_CBC_SHA(0x0039), TLS_DHE_DSS_WITH_AES_256_CBC_SHA(0x0038), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(0xC023), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(0xC027), TLS_RSA_WITH_AES_128_CBC_SHA256(0x003C), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(0xC025), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(0xC029), TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(0x0067), TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(0x0040), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(0xC009), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(0xC013), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(0xC004), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(0xC00E), TLS_DHE_RSA_WITH_AES_128_CBC_SHA(0x0033), TLS_DHE_DSS_WITH_AES_128_CBC_SHA(0x0032), TLS_EMPTY_RENEGOTIATION_INFO_SCSV(0x00FF)]",
  "compression methods" : "00",
  "extensions"          : [
    "server_name (0)": {
      type=host_name (0), value=www.deribit.com
    },
    "supported_groups (10)": {
      "versions": [secp256r1, secp384r1, secp521r1, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192]
    },
    "ec_point_formats (11)": {
      "formats": [uncompressed]
    },
    "signature_algorithms (13)": {
      "signature schemes": [ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512, dsa_sha256, ecdsa_sha224, rsa_sha224, dsa_sha224, ecdsa_sha1, rsa_pkcs1_sha1, dsa_sha1]
    },
    "signature_algorithms_cert (50)": {
      "signature schemes": [ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512, dsa_sha256, ecdsa_sha224, rsa_sha224, dsa_sha224, ecdsa_sha1, rsa_pkcs1_sha1, dsa_sha1]
    },
    "extended_master_secret (23)": {
      <empty>
    },
    "supported_versions (43)": {
      "versions": [TLSv1.2, TLSv1.1, TLSv1, SSLv3]
    }
  ]
}
)
javax.net.ssl|SEVERE|01|main|2023-01-07 12:16:58.146 CST|TransportContext.java:316|Fatal (HANDSHAKE_FAILURE): Couldn't kickstart handshaking (
"throwable" : {
  javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
  	at sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1561)
  	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1391)
  	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1291)
  	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435)
  	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
  	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
  	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
  	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
  	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
  	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:352)
  	at si.mazi.rescu.HttpTemplate.receive(HttpTemplate.java:122)
  	at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:162)
  	at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:119)
  	at com.sun.proxy.$Proxy14.getOrderBook(Unknown Source)
  	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataServiceRaw.getDeribitOrderBook(DeribitPerpetualSwapMarketDataServiceRaw.java:35)
  	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataService.getOrderBook(DeribitPerpetualSwapMarketDataService.java:33)
  	at org.market.hedge.deribit.swap.DeribitMarketDataTest.getDeribitOrderBookTest(DeribitMarketDataTest.java:42)
  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.lang.reflect.Method.invoke(Method.java:498)
  	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
  	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
  	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
  	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
  	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
  	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
  	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
  	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
  	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
  	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
  	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
  	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
  	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
  	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
  	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
  	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
  	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
  	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
  	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
  Caused by: java.io.EOFException: SSL peer shut down incorrectly
  	at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:167)
  	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
  	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1383)
  	... 40 more}

)
javax.net.ssl|FINE|01|main|2023-01-07 12:16:58.147 CST|SSLSocketImpl.java:1601|close the underlying socket
javax.net.ssl|FINE|01|main|2023-01-07 12:16:58.147 CST|SSLSocketImpl.java:1620|close the SSL connection (initiative)
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
	at sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1561)
	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1391)
	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1291)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:352)
	at si.mazi.rescu.HttpTemplate.receive(HttpTemplate.java:122)
	at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:162)
	at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:119)
	at com.sun.proxy.$Proxy14.getOrderBook(Unknown Source)
	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataServiceRaw.getDeribitOrderBook(DeribitPerpetualSwapMarketDataServiceRaw.java:35)
	at org.market.hedge.deribit.perpetualSwap.service.DeribitPerpetualSwapMarketDataService.getOrderBook(DeribitPerpetualSwapMarketDataService.java:33)
	at org.market.hedge.deribit.swap.DeribitMarketDataTest.getDeribitOrderBookTest(DeribitMarketDataTest.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:167)
	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1383)
	... 40 more

可看到日志No available cipher suite for TLS13 没有可用的TLSv1.3 协议所导致的。

No available cipher suite for TLS13 没有可用的TLSv1.3 协议所导致

2. 查看jdk支持TLS版

SSLContext context1 = SSLContext.getInstance("TLS");
context1.init(null, null, null);
String[] supportedProtocols = context1.getDefaultSSLParameters().getProtocols();
System.out.println("Enabled Protocol: "+Arrays.toString(supportedProtocols));

# console 
# Enabled Protocol: [TLSv1.2, TLSv1.1, TLSv1, SSLv3]

jdk1.8 不支持TLSv1.3

3. Java HTTPS请求默认使用的TLS版本

解决方案

1.切换jdk版本

需要提及如切换到JDK11 或更高版本是禁用SSLv3, TLSv1, TLSv1.1,想要使用解决如下

第一种解决方案
  • JDK11 或更高版本java.security 文件在系统中的目录路径位于

  • $JAVA_HOME/conf/security/java.security

  • jdk.tls.disabledAlgorithms参数 对应需要使用协议删除保存即可

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \\
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL
第二种解决方案
  • 启用自定义安全配置

  • 启动项增加

-Djava.security.properties=/path/to/your/es.java.security

2.不切换jdk情况下更改java.security增加Azul的OpenJSSE lib对TSLv1.3的支持

  • 当然还有其他jdk版本也支持TSLv1.3,本文以Azul的JDK se 8为例子

  • 将OpenJSSE增加到java.security文件第一个位置

  • JDK8java.security 文件在系统中的目录路径

  • $JAVA_HOME/jre/lib/security/java.security文章来源地址https://www.toymoban.com/news/detail-412684.html

security.provider.1=org.openjsse.net.ssl.OpenJSSE

到了这里,关于java.io.EOFException: SSL peer shut down incorrectly jdk1.8不支持TSLv1.3问题解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • websocket报错:java.io.EOFException: null

    提示:我这里是websocket在断开连接时就会提示这个错误,但websocket连接的时候没问题,不太清楚怎么回事,如有大佬清楚,希望可以指教一下,谢谢 既然提示没有为它配置错误处理,那我们就为它配置一下错误处理 注意上面两个参数是一点要的,不要的话启动会报错,不要

    2024年02月11日
    浏览(38)
  • java.io.EOFException产生的原因以及解决方法

    使用ObjectInputStream类往文件中传入自定义类student时 02 异常产生原因 经过导师查找,终于发现了OFException产生的原因 objectInputStream为空值,则不能使用objectInputStream.close();如果使用会产生并发症 java.lang.NullPointerException(空指针异常) 03 异常解决 在finally语句内加上判断,不等于

    2024年02月09日
    浏览(42)
  • 解决方案 SHUTDOWN_STATE xmlrpclib.py line: 794 && ERROR: supervisor shutting down

    重新加载 Supervisor 配置 : 这将重新读取 Supervisor 的配置文件,更新进程组,然后重启所有进程。 查看 Supervisor 日志 : 这将显示 Supervisor 的日志文件,您可以查看其中的错误信息以获取更多细节。 supervisord -c /etc/supervisord.conf 错误  Error: Another program is already listening on a port

    2024年04月23日
    浏览(32)
  • STLINK下载程序出现cannot access target. shutting down debug session问题解决的一般步骤

    不要觉得只有USB接口线会出问题,排线也有可能出问题。 通过上网搜索得知,查找代码是不是使用了下载的接口 PB3和PB4 I/O口,如果使用了,初始化了的话,需要改为其他 IO 口 有时会出现Cannot Load Flash Programming Algorithm 有时会出现Could not stop Cortex-M device.Please check the JTAG cabl

    2024年02月15日
    浏览(40)
  • websocket链接断开服务器报错java.io.EOFException解决办法

    首先说一下报错原因,由于默认60s无消息交互就会关闭长连接,所以导致这个报错 解决方案其实也很简单,既然是长时间没有通信导致断开,其实保持通信就好,可以设置心跳时间来解决。 可以前端也可以后端,附上前端代码吧 //心跳检测 var heartCheck = {     timeout: 60000,//

    2024年02月08日
    浏览(54)
  • Error parsing HTTP request header java.io.EOFException: null

    问题: 我用postman请求就是正常的,但是用java的程序去请求就会报错这个: 2024-01-17 16:38:52.077 DEBUG [http-nio-8885-exec-1][org.apache.coyote.http11.Http11Processor]182 Error parsing HTTP request header java.io.EOFException: null at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1259) at o

    2024年01月21日
    浏览(44)
  • java.io.IOException: unexpected end of stream on 以及java.io.EOFException: \n not found: limit=0

    java.io.IOException: unexpected end of stream on java.io.OKHttp Caused by: java.io.EOFException: n not found: limit=0 content=… 在一次使用OkHttp对接两个第三方接口的时候遇到了这个报错,情景是这样的,先请求第一个接口得到一个结果,再把第一个结果作为参数传到第二个接口,但是第二个接口一直

    2024年02月12日
    浏览(52)
  • Java: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

    我们在平时练习的时候一般使用低版本的jdk来练习,以便了解不同版本jdk的区别,下面是我们练习中遇到的问题    此代码在本地开发环境正常运行,但是在服务器上mHttpClient.execute会报错:  Exception in thread \\\"main\\\" javax.NET.ssl.SSLPeerUnverifiedException: peer not authenticated 本地开发环境

    2024年02月22日
    浏览(41)
  • java.io.IOException: Connection reset by peer

    接口返回的时候报错,java.io.IOException: Connection reset by peer,具体报错信息如下: 原因: 接口返回的数据量太大报错, 解决办法: 修改nginx缓存配置信息。 nginx原配置信息: nginx修改后信息: 注意: \\\"proxy_busy_buffers_size\\\"必须等于或大于\\\"proxy_buffer_size\\\"的最大值。

    2024年02月16日
    浏览(47)
  • 有关 java.io.IOException: Connection reset by peer 解决问题方法之一

    有很多大佬已经终结出现这个错误的原因有一下几种 1. 服务器在接受处理用户请求时,自身的cpu、io、内存、线程等资源都是有最大限制的。当并发请求超过服务器的承载量时,服务器会停掉一些请求。(但是要注意如果实际的并发数量没有超过服务器的承载量,可能中了木

    2024年02月22日
    浏览(66)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包