最后,我解决了我的问题。您应该在加载网站之前添加以下代码:
// Create a trust manager that does not validate certificate chainsTrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } } };// Install the all-trusting trust managertry { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());} catch (GeneralSecurityException e) {} // Now you can access an https URL without having the certificate in the truststoretry { URL url = new URL("https://hostname/index.html"); } catch (MalformedURLException e) {} //now you can load the content:webEngine.load("https://example.com");注意: 此代码片段只是禁用证书验证,而不是信任它。



