hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Dundon" <m...@thedundons.co.uk>
Subject error connecting to HTTPS avax.net.ssl.SSLHandshakeException: unknown certificate
Date Sat, 06 Oct 2007 22:12:04 GMT
Hi I'm getting the following stack trace

[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R Fatal transport error:
unknown certificate
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R
javax.net.ssl.SSLHandshakeException: unknown certificate
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.bg.a(Unknown Source)
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.b.a(Unknown
Source)
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.b.write(Unknown Source)

from this code ...  anyone know how to overcome the handshake exception?

HttpClient client = new HttpClient();
PostMethod post = new PostMethod("https://somehttpsurl.com");

NameValuePair[] data = {
    new NameValuePair("name1", "value1"),
....
    new NameValuePair("nameX","valueX")
    };

post.setRequestBody(data);

try
{
    // Execute the method.
    int statusCode = client.executeMethod(post);

    if (statusCode != HttpStatus.SC_OK)
    {
        System.err.println("Method failed: " + post.getStatusLine());
    }

    // Read the response body.
    byte[] responseBody = post.getResponseBody();

    // Deal with the response.
    // Use caution: ensure correct character encoding and is not binary data
    out.println(new String(responseBody));
}
catch (HttpException e)
{
    System.err.println("Fatal protocol violation: " + e.getMessage());
    e.printStackTrace();

}
catch (IOException e)
{
    System.err.println("Fatal transport error: " + e.getMessage());
    e.printStackTrace();
}
finally
{
    // Release the connection.
    post.releaseConnection();
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message