简体   繁体   中英

Java application show PKIX path building failed when calling external api

My application is running for fetch data from a website with https: let say https://api.something.com

When I call with Apache HttpClient using HttpClients.createDefault();

It return the above error show PKIX path building failed.

Even I use Postman to call the api. I still need to disable SSL certification verification to make the call success.

My question is:

  1. Is this is a one way ssl verification? because I don't post data to that domain. I only pull data from it. So server don't have to know who I am. But I can know that's exactly the server I call, and api response is from that domain as well (no middle man). Is my concept correct?

  2. So to resolve this problem, can I just use a dummy sslContext?

thanks a lot

是的,它可能是TLS一种方式,但是您应该拥有在 Java(或其他客户端)的信任存储中颁发服务器证书的 CA 证书,才能进行SSL连接。

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