hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Katz <gk...@allot.com>
Subject Re: Fluent API
Date Mon, 13 Feb 2012 19:44:05 GMT
Thanks I'll try that. I was wondering though why does the library even try to perform SSL stuff
as my URL is not https. Also; I am currently using the good old legacy http client 3 and never
had any problems for such an easy use case. My point is that I tried the fluent API as it
looked promising with regard to ease of use but it seems like its not exactly the case. Just
my 2 cents as a non expert user.
Thanks for the quick reply!

Oleg Kalnichevski <olegk@apache.org> wrote:


On Mon, Feb 13, 2012 at 03:26:55PM +0000, Guy Katz wrote:
> Hi;
> I am having trouble executing a simple http request via fluent API.
> This is the stack trace I get:
> "Exception in thread "main" java.lang.ExceptionInInitializerError
>       at org.apache.http.client.fluent.Request.execute(Request.java:145)
>       at com.consult.waves.util.HTTPUtils.execRequest(HTTPUtils.java:37)
>       at com.consult.waves.util.HTTPUtils.requestAsStream(HTTPUtils.java:20)
>       at com.consult.waves.util.HTTPUtils.main(HTTPUtils.java:45)
> Caused by: java.lang.IllegalStateException: Failure initializing default system SSL context
>       at org.apache.http.conn.ssl.SSLSocketFactory.createSystemSSLContext(SSLSocketFactory.java:371)
>       at org.apache.http.conn.ssl.SSLSocketFactory.getSystemSocketFactory(SSLSocketFactory.java:204)
>       at org.apache.http.impl.conn.SchemeRegistryFactory.createSystemDefault(SchemeRegistryFactory.java:82)
>       at org.apache.http.client.fluent.Executor.<clinit>(Executor.java:59)
>       ... 4 more
> Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
>       at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:771)
>       at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
>       at java.security.KeyStore.load(KeyStore.java:1185)
>       at org.apache.http.conn.ssl.SSLSocketFactory.createSystemSSLContext(SSLSocketFactory.java:304)
>       at org.apache.http.conn.ssl.SSLSocketFactory.createSystemSSLContext(SSLSocketFactory.java:369)
>       ... 7 more
> Caused by: java.security.UnrecoverableKeyException: Password verification failed
>       at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:769)
>       ... 11 more"
>
> The URL I request has nothing to do with https so I am not sure why there is a SSL context
involved here. I am working with jdk 6. I have a JSSECACERTS file in the jre/lib/security/
(this is the only change I did to the VM).
> Here's a code snippet:
> String urll = "http://images.oneddl.eu/images/7264lperi1a5qhce4uoo.jpg";
>                   Request req = Request.Get(url);
>                   return req.version(HttpVersion.HTTP_1_1)
>                     //.connectTimeout(HTTPUtils.timeout)
>                     //.socketTimeout(HTTPUtils.timeout)
>                     .execute().returnContent();
> Any ideas?

SchemeRegistryFactory#createSystemDefault() used by the fluent facade API tries to initialize
the default SSL context based on the system properties passed to the JVM process. Apparently
there is something wrong with the system trust store or its password. If you have changed
the default password on the trust store try passing it to the JVM through the 'javax.net.ssl.trustStorePassword'
system property.

Oleg


> Thanks in advance
>
>
>
>
>
> ##############################################################################################
> This message is intended only for the designated recipient(s).It may contain confidential
or proprietary information.
> If you are not the designated recipient, you may not review, copy or distribute this
message.
> If you have mistakenly received this message, please notify the sender by a reply e-mail
and delete this message.
> Thank you.
> ##############################################################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

##############################################################################################
This message is intended only for the designated recipient(s).It may contain confidential
or proprietary information.
If you are not the designated recipient, you may not review, copy or distribute this message.
If you have mistakenly received this message, please notify the sender by a reply e-mail and
delete this message. 
Thank you.
##############################################################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message