Apache HTTPClient problem?

Showing 1-6 of 6 messages
Apache HTTPClient problem? Leonardo Luiz 4/13/09 9:47 PM
I am using an Amazon API that makes HTTP requests through Apache
Httpclient. It's causing an error.
For me, it looks like Httpclient is trying to create a thread and it's
being blocked by the Sandbox.
Is there any way to fix this problem?

Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkPermission(DevAppServerFactory.java:76)
        at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkAccess(DevAppServerFactory.java:98)
        at java.lang.ThreadGroup.checkAccess(Unknown Source)
        at java.lang.Thread.init(Unknown Source)
        at java.lang.Thread.<init>(Unknown Source)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
$ReferenceQueueThread.<init>(MultiThreadedHttpConnectionManager.java:
1039)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection
(MultiThreadedHttpConnectionManager.java:164)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access
$900(MultiThreadedHttpConnectionManager.java:64)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
$ConnectionPool.createConnection
(MultiThreadedHttpConnectionManager.java:750)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection
(MultiThreadedHttpConnectionManager.java:469)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout
(MultiThreadedHttpConnectionManager.java:394)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod
(HttpMethodDirector.java:152)
        at org.apache.commons.httpclient.HttpClient.executeMethod
(HttpClient.java:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod
(HttpClient.java:324)


Re: [appengine-java] Apache HTTPClient problem? Shane Witbeck 4/14/09 4:39 AM
I've had the same issue with HttpClient. I believe it's happening because it's trying to spawn threads which is not allowed in GAE. 

I haven't found a solution yet (such as configuring HttpClient to use just 1 thread) which I'm not sure is possible?

-Shane
Re: [appengine-java] Re: Apache HTTPClient problem? Robert Hanson 4/14/09 5:42 AM
Have you tried using a different connection manager?

client = new HttpClient(new SimpleHttpConnectionManager());

Or what about using the URLFetchService?

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/urlfetch/URLFetchService.html

Rob
Re: Apache HTTPClient problem? Leonardo Luiz 4/14/09 8:09 AM
I thought about it, but that implies in patching Amazon API or
HTTPClient. It's possible, once both are open source projects. Despite
of that, I'd like a short cut to fix it.


On Apr 14, 9:42 am, Robert Hanson <iamroberthan...@gmail.com> wrote:
> Have you tried using a different connection manager?
>
> client = new HttpClient(new SimpleHttpConnectionManager());
>
> Or what about using the URLFetchService?
>
> http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
>
> Rob
>
> On Tue, Apr 14, 2009 at 7:39 AM, Shane Witbeck <sh...@digitalsanctum.com> wrote:
> > I've had the same issue with HttpClient. I believe it's happening because
> > it's trying to spawn threads which is not allowed in GAE.
> > I haven't found a solution yet (such as configuring HttpClient to use just 1
> > thread) which I'm not sure is possible?
> > -Shane
>
> > On Tue, Apr 14, 2009 at 12:47 AM, Leonardo Luiz <leonard...@gmail.com>
Re: [appengine-java] Re: Apache HTTPClient problem? Shane Witbeck 4/14/09 2:05 PM
I use the URLFetch service to get objects from S3 but haven't tried using it to put objects. I started down the road of using a new HttpClient but not complete yet.

I'd be interested in hearing how others are working around this issue.

-Shane
Re: [appengine-java] Re: Apache HTTPClient problem? Jason (Google) 4/15/09 11:02 AM
Libraries with an HttpClient dependency will run into issues since applications are not allowed to spin up new threads or make direct network connections. As Shane noted, you should be able to use URL Fetch to hit the REST endpoints directly.

- Jason