HttpsURLConnection - Problem in SSL Handshaking - Weblogic

This is a discussion on HttpsURLConnection - Problem in SSL Handshaking - Weblogic ; I am trying to make HttpsURLConnection, but I got javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found exception. I included my code here If u find anything wrong here, please let me know System.setProperty("javax.net.debug","all"); System.setProperty("UseSunHttpHandler", "true"); System.setProperty("http.proxySet", "true"); System.setProperty("http.proxyHost", "my proxy ip"); ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: HttpsURLConnection - Problem in SSL Handshaking

  1. HttpsURLConnection - Problem in SSL Handshaking

    I am trying to make HttpsURLConnection, but I got javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found exception.

    I included my code here

    If u find anything wrong here, please let me know

    System.setProperty("javax.net.debug","all");

    System.setProperty("UseSunHttpHandler", "true");
    System.setProperty("http.proxySet", "true");
    System.setProperty("http.proxyHost", "my proxy ip");
    System.setProperty("http.proxyPort", "80");

    System.setProperty("java.protocol.handler.pkgs","javax.net.ssl");

    String c_keystore = "madhu.keystore";
    System.setProperty("javax.net.ssl.keyStore",c_keystore);
    System.setProperty("javax.net.ssl.keyStorePassword","madhu123");
    System.setProperty("javax.net.ssl.trustStore",c_keystore);
    System.setProperty("javax.net.ssl.trustStorePassword","madhu123");

    com.sun.net.ssl.internal.ssl.Provider.install();
    java.security.Security.insertProviderAt(new com.sun.net.ssl.internal.ssl.Provider(), 1);

    //URL url = new URL("https://myhostname/myfile.jsp");
    URL url = new URL(null, "https://myhostname/myfile.jsp", new com.sun.net.ssl.internal.www.protocol.https.Handler());

    HttpsURLConnection urlConn; //I tried with HttpURLConnection also
    DataOutputStream printout;
    BufferedReader input;
    String content = "loginname=neonlines&password=password";

    System.out.println("OPEN CONNECTION");

    urlConn = (HttpsURLConnection)url.openConnection(); //I tried with HttpURLConnection also
    urlConn.setDoInput(true);
    urlConn.setDoOutput(true);
    urlConn.setUseCaches(false);
    urlConn.setRequestMethod("POST");
    urlConn.setFollowRedirects(true);



    System.out.println("READ INPUT STREAM");

    input = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); //EXCEPTION IN THIS LINE
    String str;
    String line = "";
    System.out.println("PRINTING THE PAGE ");
    while((str = input.readLine()) != null) {
    System.out.println(str);
    line += str;
    }


    I added the keystore "madhu.keystore" using keytool from x509 (extension cer)


    I got the following exception

    xecuteThread: '19' for queue: 'weblogic.kernel.Default', SEND TLSv1 ALERT: fatal, description = certificate_unknown
    ExecuteThread: '19' for queue: 'weblogic.kernel.Default', WRITE: TLSv1 Alert, length = 2
    ExecuteThread: '19' for queue: 'weblogic.kernel.Default', called closeSocket()
    ExecuteThread: '19' for queue: 'weblogic.kernel.Default', handling exception: javax.net.ssl.SSLHandshakeException: sun.security.vali
    dator.ValidatorException: No trusted certificate found
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(D ashoA6275)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Dasho A6275)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Dasho A6275)
    at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA62 75)
    at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA62 75)
    at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA62 75)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Dasho A6275)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Dasho A6275)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHa ndshake(DashoA6275)
    at sun.net.http://www.protocol.https.HttpsClien...ect(DashoA6275)
    ..
    ..
    ..
    ..
    more

    Please let me know where I 'm doing wrong.

  2. Re: HttpsURLConnection - Problem in SSL Handshaking

    I solved the problem by muyself.

    I dynamically installed the certificate using TrustManagerFactory and now it's working fine

  3. Re: HttpsURLConnection - Problem in SSL Handshaking

    Hi neonlines,

    I am having the same problem that you had. I don't understand what you mean by " dynamically installed the certificate using TrustManagerFactory". Please elaborate on this, adding some code of how you did it will help a lot.

    Thanks in advance.
    bolandino

+ Reply to Thread