raul wrote:
Hi all, this is my first message in the list, sorry for my english, im spanish 
;D

My problem is this (when try to access to a HTTPS site):


Fatal transport error: java.security.cert.CertificateException: Could not find 
trusted certificate
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: 
Could not find trusted certificate
Raul,

You need to configure the SSL context properly. Please take a look at the HttpClient SSL guide:

http://jakarta.apache.org/commons/httpclient/sslguide.html

Oleg



 at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
 at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
 at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
 at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
 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 servidorrecargas.bot.httpClient(bot.java:86)
 at servidorrecargas.bot.main(bot.java:62)

Caused by: java.security.cert.CertificateException: Could not find trusted 
certificate
 at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.a(DashoA6275)
 at 
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA6275)
 at 
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA6275)
 ... 18 more


The code I use is this (I have JSSE1.0.3 installed):

String url = "https://www.my-site.com/directory/";;


 // Create an instance of HttpClient.
    HttpClient client = new HttpClient();

    // Create a method instance.
    GetMethod method = new GetMethod(url);

    // Provide custom retry handler is necessary
    method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                                    new DefaultHttpMethodRetryHandler(3, 
false));

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

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

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

      // Deal with the response.
      // Use caution: ensure correct character encoding and is not binary data
      System.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.
      method.releaseConnection();
    }


where is the problem?? when I access to a HTTP site there is no problem, only 
with HTTPS sites.
THANKS IN ADVANCE!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to