今天青岛镜像的vip访问SSO-CAS的443端口终于通了,但是发现别的应用连的时候报
错误
Caused by: 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
根据以往的经验,这个错误很明显是不信任服务器端的数字证书引起的,所以我就疑惑了,因为证书使用的是买的证书,且在现在的正式环境上好好的用着。
这个时候我就开始写起测试代码了。
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class SSLTest {
public static void main(String[] args) throws Exception {
URL myURL = new URL("https://xxx.xxx.com");
HttpsURLConnection httpsConn = (HttpsURLConnection) myURL.openConnection();
InputStreamReader insr = new InputStreamReader(httpsConn.getInputStream());
int r