我有以下设置

在端口7001上运行的TestDomain1(未启用SSL侦听端口)

  • wls console - > AdminServer - > Keystore选项卡
Keystores: Demo Identity and Demo Trust
  Demo Identity Keystore: C:\Oracle\Middleware\Oracle_Home\user_projects\domains\TestDomain\security\DemoIdentity.jks
  Demo Trust Keystore:

C:\ PROGRA〜1 \ ORACLE \ ORACLE〜1个\ wlserver的\服务器\ lib中\ DemoTrust.jks

  • wls console - > AdminServer - > SSL选项卡
Identity and Trust Locations: Keystore
  Certificate Location: from Demo Identity Keystore
  Trusted Certificate Authorities: from Demo Trust Keystore and Java Standard Trust Keystore

在端口9001和SSL侦听端口上运行的TestDomain2(已启用SSL)为7002 .

Exactly same setup as above domain (so both domain were created with
 default setup and I have not made any changes except enabling SSL
 listen port in this domain)

我有一个在TestDomain1上运行的web服务,这个webservice在TestDomain2上调用一个HTTPS URL . 我在TestDomain1上遇到以下错误

javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径

这个错误是什么意思 . 基于上述设置,TestDomain1中已经提供了信任库路径 . 我不是在试用2路SSL . 我只是想能够调用和HTTPS URL .

以下是我访问HTTPS URL的代码

HttpClient client = new HttpClient();

ProtocolSocketFactory factory = new SSLProtocolSocketFactory();
    Protocol https = new Protocol("https", factory, 7002);
    client.getHostConfiguration().setHost("localhost", 7002, https);

    PostMethod post = new PostMethod("https://localhost:7002/somecontext/someresource");
    post.setParameter("sapCreateRequest", request.getSapRequestPayload());
    try {
        client.executeMethod(post);
        BufferedReader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
        String line = null;
        while((line = reader.readLine()) != null) {
            logger.info(line);
        }
        // print response to stdout
        System.out.println(post.getResponseBodyAsStream());
    } catch(Exception ex) {
        logger.error("Error while communicating with SSL resource: {}", ex.getMessage());
    } finally {
        // be sure the connection is released back to the connection 
        // manager
        post.releaseConnection();
    }