Questions
Two days ago, a schoolboy asked a question in the group:
Can you tell me why sending https requests with Ali cloud server fails, is there some other configuration needed?
The same code can access the https interface locally, but not the server, and the server can access the http interface.
HttpsURLConnection is used
I thought it was very interesting, so I asked him to give me the requested URL, and then I tested it on the machine with the curl
command:
Found an error related to SSL, I guess it may be related to the HTTPS certificate. But I couldn’t reach his code and server, so I had to ask him to show me the log in catalina.out
Sure enough, an exception related to SSL was found in the log
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
... more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
... more
Why
OK, it’s easy to find exceptions. Take the error message and search Baidu for the solution~
The Internet is talking about the problem of TLS version. The default TLS version of jdk1.7 is 1.0. Just change the TLS version to 1.1 or 1.2
Solutions
Someone raised the same problem in stack overflow
, and Daniel also gave the corresponding solution: javax.net.ssl.sslhandshakeeexception: Remote host closed connection during handshake during web service communication.
Similar Posts:
- Azkaban Start web–javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.se
- [Solved] javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
- [Solved] JDBC connection to SQL Service reported an error: “the driver cannot establish a secure connection with SQL server by using SSL encryption“
- javax.net.ssl.SSLHandshakeException: No appropriate protocol [How to Solve]
- GC plug in of jvasualvm + error “not supported for this JVM” + command jstatd
- [Solved] Exception in thread “main” javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
- [Solved] SSH connection server error: warning: remote host identification has changed!
- [note] solve the problem of error during websocket Handshake: Net:: err when using workerman and Apache to create WSS service_ RESPONSE_ HEADER…
- [Solved] MYSQL Remote connection 2003 Error: can’t connect to MYSQL server on ”(10060)
- [Solved] Accessing MSSql under Ubuntu prompts SSL Handshake failed with OpenSSL error