0

我正在运行这个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) {

我在这里做错了什么?自编写该示例以来情况是否发生了变化?

4

1 回答 1

-2

由于某种原因,您的证书可能无效(或未加载)。启用调试模式应该可以帮助您找到更多问题

System.setProperty("javax.net.debug", "all");

此外,如果您使用自签名证书,请查看:http ://ctasada.blogspot.com.es/2010/11/httpclient-use-self-signed-certificates.html

于 2012-04-24T21:05:56.937 回答