Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:882)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
... 35 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:462)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
... 41 more
今天使用新浪微博API获取公共数据。当数据记录到达约137万条的时候,程序报如上错误!
最后在stackoverflow找到了答案:大部分是因为jdk版本的原因。换成jdk 1.7就好了,程序至今还没报上述错误!
服务端运行的是tomcat 7,运行在 Java 7, Linux, and Amazon EC2等类似环境中。同样客户端要求运行在同等版本java环境下。文中进一步提出了一个深奥的问题:是否在java 6中有同样的加密或协议设置,使得程序在java 6环境下能够正常运行。
像java出现了问题,并报错,用外文搜索引擎比较容易找到答案!
注:问题又重现了,跟网速也有关系 2014-01-05
解决方案的原文地址:http://stackoverflow.com/questions/15589880/how-to-make-java-6-which-fails-ssl-connection-with-ssl-peer-shut-down-incorrec 点击打开链接