I am trying to connect to a server using HTTPS The server has a self singed certificate (It is an internal server for testing)
When I use postman to hit the server , It is working fine (and shows a red indication about self signed certificate)
But when using from Java I get this error
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Postman does not have the certificate and it is still successful ? how come?
My Code (using feign):
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(new TrustSelfSignedStrategy());
SSLContext sslContext = builder.build();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext);
Client feignClient = Client.Default(sslConnectionSocketFactory, new NoopHostnameVerifier());
...
Is there an option in Java not to use a certificate file (and not to install the certificate on the PC)
Thanks