I have a Jersey client deployed in JEE 7 application. I'm trying to reach out to REST web service deployed over TLS protocol. When I use the same code in a standard java SE 8 application, it does work. But in the web application deployed on wildfly 9.0.2 I got the following error:
javax.ws.rs.ProcessingException: 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
Bellow is the client code
Client client = ClientBuilder.newBuilder().build();
HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basic("login","password");
client.register(authFeature);
String host = "https://example.com";
Response response = client.target(host).path("create")
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(json.toString(), MediaType.APPLICATION_JSON));
here is my jersey client in the pom.xml file
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.24</version>
</dependency>
"https://example.com" has got a valid and secure TLS certificate.
I'm using: wildfly 9.0.2; Java EE 7; Java SE 8; jersey client 2.24
Thanks for any help.