Error consuming REST service : CertPathBuilderException
Hi,
I tried creating a simple java client to call one of the jazz REST services... (e.g., https://localhost:9443/ccm/rootservices).
I used Apache commons library for HttpClient, passed the credentials to the GetMethod. While calling 'execute()' on the HttpClient, I'm getting java.security.cert.CertPathBuilderException.
My example works on other example-sites.
Here is the complete stack-trace:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.jsse2.n.a(n.java:3)
at com.ibm.jsse2.jc.a(jc.java:335)
at com.ibm.jsse2.db.a(db.java:101)
at com.ibm.jsse2.db.a(db.java:198)
at com.ibm.jsse2.eb.a(eb.java:124)
at com.ibm.jsse2.eb.a(eb.java:198)
at com.ibm.jsse2.db.m(db.java:71)
at com.ibm.jsse2.db.a(db.java:274)
at com.ibm.jsse2.jc.a(jc.java:541)
at com.ibm.jsse2.jc.g(jc.java:17)
at com.ibm.jsse2.jc.a(jc.java:473)
at com.ibm.jsse2.j.write(j.java:2)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:88)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:146)
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at com.ibm.team.sdwb.connector.client.DeliciousApp.main(DeliciousApp.java:32)
Caused by: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.jsse2.util.f.b(f.java:11)
at com.ibm.jsse2.util.f.b(f.java:92)
at com.ibm.jsse2.util.e.a(e.java:7)
at com.ibm.jsse2.yb.checkServerTrusted(yb.java:22)
at com.ibm.jsse2.hb.checkServerTrusted(hb.java:8)
at com.ibm.jsse2.eb.a(eb.java:76)
... 17 more
Caused by: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:379)
at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:195)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:215)
at com.ibm.jsse2.util.f.b(f.java:66)
... 22 more
I tried creating a simple java client to call one of the jazz REST services... (e.g., https://localhost:9443/ccm/rootservices).
I used Apache commons library for HttpClient, passed the credentials to the GetMethod. While calling 'execute()' on the HttpClient, I'm getting java.security.cert.CertPathBuilderException.
My example works on other example-sites.
Here is the complete stack-trace:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.jsse2.n.a(n.java:3)
at com.ibm.jsse2.jc.a(jc.java:335)
at com.ibm.jsse2.db.a(db.java:101)
at com.ibm.jsse2.db.a(db.java:198)
at com.ibm.jsse2.eb.a(eb.java:124)
at com.ibm.jsse2.eb.a(eb.java:198)
at com.ibm.jsse2.db.m(db.java:71)
at com.ibm.jsse2.db.a(db.java:274)
at com.ibm.jsse2.jc.a(jc.java:541)
at com.ibm.jsse2.jc.g(jc.java:17)
at com.ibm.jsse2.jc.a(jc.java:473)
at com.ibm.jsse2.j.write(j.java:2)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:88)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:146)
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at com.ibm.team.sdwb.connector.client.DeliciousApp.main(DeliciousApp.java:32)
Caused by: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.jsse2.util.f.b(f.java:11)
at com.ibm.jsse2.util.f.b(f.java:92)
at com.ibm.jsse2.util.e.a(e.java:7)
at com.ibm.jsse2.yb.checkServerTrusted(yb.java:22)
at com.ibm.jsse2.hb.checkServerTrusted(hb.java:8)
at com.ibm.jsse2.eb.a(eb.java:76)
... 17 more
Caused by: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target
at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:379)
at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:195)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:215)
at com.ibm.jsse2.util.f.b(f.java:66)
... 22 more