posted 18 years ago
Hi All,
I am trying connect to webserver using https from apche HttpClient.
I created keystore and placed in server. The same configured in server.xml too. If I am invoking through browser its working fine. but if i try to invoke through HttpClient its throwing following exception. Pls help me in this regards.
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(DashoA12275)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA12275)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:67)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:125)
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 test.SSLTest.main(SSLTest.java:36)
My Client code snipet is
HttpClient httpclient = new HttpClient();
java.security.Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider());
PostMethod httpget = new PostMethod("myurl"); //servlet url
try {
httpclient.executeMethod(httpget);
System.out.println(httpget.getStatusLine());
} catch(Exception e){
System.out.println(" Exception "+e);
e.printStackTrace();
}finally {
httpget.releaseConnection();
}
}