To use SSL. You need to register a trust manager. There is a default non-op trust manager provided. Before calling your request, call AbderaClient.registerTrustManager() and things should work.
- James herbert wrote: > Hi! > > I have a problem with an Abdera-Client 0.3.0. > > I send a HTTP-GET-request to a APP-Server, that responds > to this request with a HTTP-302-Response and a new > location, that uses HTTPS. > > My send-code looks like this: > Abdera abdera = new Abdera(); > AbderaClient client = new AbderaClient(abdera); > RequestOptions requestOptions = makeSomeOptions(); > ClientResponse response = client.get(serverURL, requestOptions); > > After this line the AbderaClient should have given back these values in the > response-Object: > response.getStatus() = 302 > response.getLocation() = "https://newURLGivenByServer" > > But something goes wrong and I get the following exception: > > org.apache.abdera.protocol.client.ClientException: > 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 > org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:415) > at > org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:129) > at ... > > The full exception-stacktrace is appended at the end of this posting. > I appended also the HTTP-GET-Request and the HTTP-Response, sniffed by > ethereal. > > I'm not sure, how to debug this issue. > > Another symptom: > If I fire another Request (e.g. a POST) over HTTPS to this server before the > GET-Request is executed, > the exception does not occur, but the result is also not that, that should > be: > > response.getStatus: 401 > response.getStatusText: Unauthorized > response.getLocation: null > > It seems to me, that something goes wrong in the execute-method of > AbderaClient, when > performing a GET-Request. This does not happen, when firing a DELETE- or a > POST-Request. > > Any ideas, how I could track this thingy? > > Regards, > > Herbert > > ***************************************************** > Full stacktrace: > > org.apache.abdera.protocol.client.ClientException: > 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 > org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:415) > at > org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:129) > at ... > Caused by: 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:11) > at com.ibm.jsse2.jc.a(jc.java:509) > at com.ibm.jsse2.db.a(db.java:17) > at com.ibm.jsse2.db.a(db.java:113) > at com.ibm.jsse2.eb.a(eb.java:49) > at com.ibm.jsse2.eb.a(eb.java:16) > at com.ibm.jsse2.db.m(db.java:250) > at com.ibm.jsse2.db.a(db.java:70) > at com.ibm.jsse2.jc.a(jc.java:187) > at com.ibm.jsse2.jc.g(jc.java:480) > at com.ibm.jsse2.jc.a(jc.java:31) > 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:828) > at > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1553) > at > org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2112) > at > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) > at > org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:401) > ... 22 more > 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:60) > at com.ibm.jsse2.util.f.b(f.java:54) > at com.ibm.jsse2.util.e.a(e.java:20) > at com.ibm.jsse2.yb.checkServerTrusted(yb.java:43) > at com.ibm.jsse2.hb.checkServerTrusted(hb.java:17) > at com.ibm.jsse2.eb.a(eb.java:271) > ... 40 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:80) > ... 45 more > > ***************************************************** > Sniffed Request: > > GET > /activities/service/atom/activitynode?activityNodeUuid=4EEGC0A83224B4ECC4CFA96C3F4A960001A6 > HTTP/1.1 > > Content-Type: application/atom+xml > > Accept: application/atom+xml;type=entry, application/atom+xml;type=feed, > application/atom+xml, application/atomsvc+xml, application/atomcat+xml, > application/xml, text/xml, */* > > Accept-Encoding: gzip, deflate > > Accept-Charset: utf-8, *;q=0.5 > > User-Agent: Abdera/v0.3.0-incubating > > Host: myserverhost:9080 > > ****************************************************** > Sniffed Response: > > HTTP/1.1 302 Found > > Location: > https://myserverhost:9443/activities/service/atom/activitynode?activityNodeUuid=4EEGC0A83224B4ECC4CFA96C3F4A960001A6 > > Content-Language: en-US > > Content-Length: 0 > > Date: Fri, 07 Dec 2007 13:32:43 GMT > > Server: WebSphere Application Server/6.1 > > ******************************************************
