简体   繁体   中英

WSClient and SSL

In Play 2.4.3 web app I need to call other service via HTTPS using WSClient . I followed the article but the error appears:

play.api.libs.ws.ssl.CompositeCertificateException: No trust manager was able to validate this certificate chain: # of exceptions = 1

The exception inside CompositeCertificateException :

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

Part of application.conf responsible for SSL:

play.ws.ssl {
  trustManager = {
    stores = [
      { type : "PEM", path : "C:/A/B/globalsign.crt" }
    ]
  }
}

What's wrong here?

I solved the problem through the following steps:

  • Run InstallCert.java to generate jssecacerts file.
  • Add path to the file in application.conf .

Config example:

play.ws.ssl {
  trustManager = {
    stores = [
      {path: "C:/A/B/jssecacerts"}
      {path: ${java.home}/lib/security/cacerts}
    ]
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM