0

I am getting the below error in the line 5 while executing the app engine code in localhost and in cloud.

1   HttpClient client = new HttpClient();
2       GetMethod getMethod =new GetMethod(url);
3       client.getHttpConnectionManager().getParams()
4       .setConnectionTimeout(1000);
5       int response = client.executeMethod(getMethod);

I am seeing this error while running the job in localhost and in app engine.

Please find the error logs below:

INFO] 2016-03-07 11:04:03 DEBUG HttpConnection:1215 - enter HttpConnection.closeSockedAndStreams()
[INFO] 2016-03-07 11:04:03 INFO  HttpMethodDirector:439 - I/O exception (java.net.SocketException) caught when processing request: Permission denied: Not allowe
d to issue a socket bind: permission denied.
[INFO] 2016-03-07 11:04:03 DEBUG HttpMethodDirector:443 - Permission denied: Not allowed to issue a socket bind: permission denied.
[INFO] java.net.SocketException: Permission denied: Not allowed to issue a socket bind: permission denied.
[INFO]  at com.google.appengine.api.socket.SocketApiHelper.translateError(SocketApiHelper.java:95)
[INFO]  at com.google.appengine.api.socket.SocketApiHelper.translateError(SocketApiHelper.java:106)
[INFO]  at com.google.appengine.api.socket.SocketApiHelper.makeSyncCall(SocketApiHelper.java:74)
[INFO]  at com.google.appengine.api.socket.AppEngineSocketImpl.createSocket(AppEngineSocketImpl.java:470)
[INFO]  at com.google.appengine.api.socket.AppEngineSocketImpl.bind(AppEngineSocketImpl.java:486)
[INFO]  at java.net.Socket.bind(Socket.java:631)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
[INFO]  at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:130)
[INFO]  at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:139)
[INFO]  at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
[INFO]  at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
[INFO]  at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
[INFO]  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[INFO]  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
[INFO]  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
[INFO]  at com.disney.unityads.UnityAdsStats.downloadZip(UnityAdsStats.java:169)
[INFO]  at com.disney.unityads.UnityAdsStats.run(UnityAdsStats.java:72)
[INFO]  at com.disney.unityads.UnityAdsChannelJobWorker.doPost(UnityAdsChannelJobWorker.java:46)
[INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
[INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[INFO]  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
[INFO]  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)

1 Answer 1

1

Check the documentation for how to make HTTP requests. AppEngine is a very limited environment, for example if you try to use an alternative HTTP client your app gets the same treatment as one that tries to use sockets directly.

https://cloud.google.com/appengine/docs/java/urlfetch/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.