我正在运行此Java + SSL Tutorial,但我收到以下错误。
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at EchoServer.main(EchoServer.java:24)
发生异常的代码中的行是:
while ((string = bufferedreader.readLine()) != null) {
我在这里做错了什么?自那个例子写完之后,事情发生了变化吗?
答案 0 :(得分:-2)
由于某种原因,您的证书可能无效(或未加载)。启用调试模式应该可以帮助您找到更多问题
System.setProperty(“javax.net.debug”,“all”);
此外,如果您使用的是自签名证书,请查看:http://ctasada.blogspot.com.es/2010/11/httpclient-use-self-signed-certificates.html