javax.net.ssl.SSLHandshakeException:

我正在使用 java 使用以下代码从网页中读取:


import java.net.*;

import java.io.*;


public class URLReader {

public static void main(String[] args)  throws Exception {


    URL oracle = new URL("http://www.example.com/");

    BufferedReader in = new BufferedReader(

    new InputStreamReader(oracle.openStream()));


    String inputLine;

    while ((inputLine = in.readLine()) != null)

        System.out.println(inputLine);

    in.close();

}

}

当我在我的 windows pc 上使用 eclipse 运行代码时,它工作正常,但是当我尝试在我的树莓派上运行它时,我得到这个错误:


javax.net.ssl.SSLHandshakeException:     sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid     certification path to requested target

我认为这意味着 java 不信任该网站,但我无法在任何地方找到解决方案。任何帮助将不胜感激。


叮当猫咪
浏览 221回答 1
1回答

蓝山帝景

如此处所述更新 java 解决了问题https://www.raspberrypi.org/forums/viewtopic.php?t=200232
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java