You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by wkeenan <wa...@gmail.com> on 2009/04/13 16:16:48 UTC
HttpClient v4 in Google App Engine fails with SSL errro for HTTP
connection
Hi,
I'm not sure if this is a bug, potential feature request, or a usage error
on my part, but when I deployed a very simple servlet to the GoogleApp
engine to perform a HTTP GET on a HTTP URL but I received a SSL related
sandbox error. URLConnection connections should (and do) work, SSL ones
are banned in GAE.
But my question is why is HTTPClient even going near the SSL for a HTTP
connection?
Is there something I can explicitly set to indicate the URL in the HttpGet
is only HTTP so please don't go looking into SSL Sockets Mr HttpClient?
Thanks
Wayne
The Excpetion:
java.lang.NoClassDefFoundError: javax.net.ssl.HttpsURLConnection is a
restricted class. Please see the Google App Engine developer's guide for
more details.
at
com.google.apphosting.runtime.security.shared.stub.javax.net.ssl.HttpsURLConnection.<clinit>(HttpsURLConnection.java)
at
org.apache.http.conn.ssl.SSLSocketFactory.<init>(SSLSocketFactory.java:244)
at
org.apache.http.conn.ssl.SSLSocketFactory.<clinit>(SSLSocketFactory.java:157)
at
org.apache.http.impl.client.DefaultHttpClient.createClientConnectionManager(DefaultHttpClient.java:160)
at
org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:221)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:539)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:444)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:416)
at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:365)
--
View this message in context: http://www.nabble.com/HttpClient-v4-in-Google-App-Engine-fails-with-SSL-errro-for-HTTP-connection-tp23022919p23022919.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: HttpClient v4 in Google App Engine fails with SSL errro for
HTTP connection
Posted by wkeenan <wa...@gmail.com>.
Hi Oleg,
After looking around the classes in your helpful snippet I think GAE will
not be a place to run HTTPClient at the moment, as GAE outlaws the use of
Sockets, but allows URLConnection.
I can't see a way to drop in a URLConnection only Scheme.
Thanks for taking your time to get back to me though.
Regards
Wayne
olegk wrote:
>
> On Mon, Apr 13, 2009 at 07:16:48AM -0700, wkeenan wrote:
>
>> But my question is why is HTTPClient even going near the SSL for a HTTP
>> connection?
>>
>
> HttpClient creates a socket factory for the https scheme upon
> initialization.
>
>> Is there something I can explicitly set to indicate the URL in the
>> HttpGet
>> is only HTTP so please don't go looking into SSL Sockets Mr HttpClient?
>>
>
> Yes, absolutely. You will, however, have to do a little more work to
> initialize HttpClient's connection manager:
>
> SchemeRegistry schemeRegistry = new SchemeRegistry();
> schemeRegistry.register(
> new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
> BasicHttpParams params = new BasicHttpParams();
> SingleClientConnManager connmgr =
> new SingleClientConnManager(params, schemeRegistry);
> DefaultHttpClient httpclient = new DefaultHttpClient(connmgr, params);
>
> Hope this helps
>
> Oleg
>
>
>> Thanks
>> Wayne
>>
>>
>> The Excpetion:
>>
>> java.lang.NoClassDefFoundError: javax.net.ssl.HttpsURLConnection is a
>> restricted class. Please see the Google App Engine developer's guide for
>> more details.
>> at
>> com.google.apphosting.runtime.security.shared.stub.javax.net.ssl.HttpsURLConnection.<clinit>(HttpsURLConnection.java)
>> at
>> org.apache.http.conn.ssl.SSLSocketFactory.<init>(SSLSocketFactory.java:244)
>> at
>> org.apache.http.conn.ssl.SSLSocketFactory.<clinit>(SSLSocketFactory.java:157)
>> at
>> org.apache.http.impl.client.DefaultHttpClient.createClientConnectionManager(DefaultHttpClient.java:160)
>> at
>> org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:221)
>> at
>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:539)
>> at
>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
>> at
>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
>> at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:444)
>> at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:416)
>> at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:365)
>> --
>> View this message in context:
>> http://www.nabble.com/HttpClient-v4-in-Google-App-Engine-fails-with-SSL-errro-for-HTTP-connection-tp23022919p23022919.html
>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/HttpClient-v4-in-Google-App-Engine-fails-with-SSL-errro-for-HTTP-connection-tp23022919p23036829.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: HttpClient v4 in Google App Engine fails with SSL errro for HTTP connection
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Apr 13, 2009 at 07:16:48AM -0700, wkeenan wrote:
>
> Hi,
>
> I'm not sure if this is a bug, potential feature request, or a usage error
> on my part, but when I deployed a very simple servlet to the GoogleApp
> engine to perform a HTTP GET on a HTTP URL but I received a SSL related
> sandbox error. URLConnection connections should (and do) work, SSL ones
> are banned in GAE.
> But my question is why is HTTPClient even going near the SSL for a HTTP
> connection?
>
HttpClient creates a socket factory for the https scheme upon
initialization.
> Is there something I can explicitly set to indicate the URL in the HttpGet
> is only HTTP so please don't go looking into SSL Sockets Mr HttpClient?
>
Yes, absolutely. You will, however, have to do a little more work to
initialize HttpClient's connection manager:
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(
new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
BasicHttpParams params = new BasicHttpParams();
SingleClientConnManager connmgr =
new SingleClientConnManager(params, schemeRegistry);
DefaultHttpClient httpclient = new DefaultHttpClient(connmgr, params);
Hope this helps
Oleg
> Thanks
> Wayne
>
>
> The Excpetion:
>
> java.lang.NoClassDefFoundError: javax.net.ssl.HttpsURLConnection is a
> restricted class. Please see the Google App Engine developer's guide for
> more details.
> at
> com.google.apphosting.runtime.security.shared.stub.javax.net.ssl.HttpsURLConnection.<clinit>(HttpsURLConnection.java)
> at
> org.apache.http.conn.ssl.SSLSocketFactory.<init>(SSLSocketFactory.java:244)
> at
> org.apache.http.conn.ssl.SSLSocketFactory.<clinit>(SSLSocketFactory.java:157)
> at
> org.apache.http.impl.client.DefaultHttpClient.createClientConnectionManager(DefaultHttpClient.java:160)
> at
> org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:221)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:539)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:444)
> at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:416)
> at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:365)
> --
> View this message in context: http://www.nabble.com/HttpClient-v4-in-Google-App-Engine-fails-with-SSL-errro-for-HTTP-connection-tp23022919p23022919.html
> Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org