org.springframework.web.client.ResourceAccessException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • This is a major problem on Google App Engine. I am periodically getting exceptions using twitter and facebook. I need to be able to change the default timeout on a request from 5 (default) to 10 seconds. http://code.google.com/appengine/docs/java/urlfetch/overview.html "You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 10 seconds for online requests and 10 minutes for offline requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline." The solution would be to extend SimpleClientHttpRequestFactory, but there doesn't appear to be a simple way to inject it. Perhaps allowing the user to provide their own ClientHttpRequestFactorySelector as a Spring bean might be a solution? This is what I need: {code} public class GAESimpleClientHttpRequestFactory extends SimpleClientHttpRequestFactory { @Override protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { connection.setConnectTimeout(10); connection.setReadTimeout(10); super.prepareConnection(connection, httpMethod); } } {code} This is the pain I am experiencing: Twitter: {code} Caused by: org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate. java:213) at org.springframework.social.twitter.api.impl.UserTemplate.getUserProfile(UserTemplate.java:54) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:42) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:30) at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:172) at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:135) at org.springframework.social.connect.support.OAuth1Connection.(OAuth1Connection.java:57) at org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59) at org.springframework.social.connect.web.ConnectController.oauth1Callback(ConnectController.java:160) {code} Facebook: {code} org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://graph.facebook.com/me; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:170) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:41) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:37) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30) {code}
    via by Scott Murphy,
  • This is a major problem on Google App Engine. I am periodically getting exceptions using twitter and facebook. I need to be able to change the default timeout on a request from 5 (default) to 10 seconds. http://code.google.com/appengine/docs/java/urlfetch/overview.html "You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 10 seconds for online requests and 10 minutes for offline requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline." The solution would be to extend SimpleClientHttpRequestFactory, but there doesn't appear to be a simple way to inject it. Perhaps allowing the user to provide their own ClientHttpRequestFactorySelector as a Spring bean might be a solution? This is what I need: {code} public class GAESimpleClientHttpRequestFactory extends SimpleClientHttpRequestFactory { @Override protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { connection.setConnectTimeout(10); connection.setReadTimeout(10); super.prepareConnection(connection, httpMethod); } } {code} This is the pain I am experiencing: Twitter: {code} Caused by: org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate. java:213) at org.springframework.social.twitter.api.impl.UserTemplate.getUserProfile(UserTemplate.java:54) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:42) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:30) at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:172) at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:135) at org.springframework.social.connect.support.OAuth1Connection.(OAuth1Connection.java:57) at org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59) at org.springframework.social.connect.web.ConnectController.oauth1Callback(ConnectController.java:160) {code} Facebook: {code} org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://graph.facebook.com/me; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:170) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:41) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:37) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30) {code}
    via by Scott Murphy,
  • This is a major problem on Google App Engine. I am periodically getting exceptions using twitter and facebook. I need to be able to change the default timeout on a request from 5 (default) to 10 seconds. http://code.google.com/appengine/docs/java/urlfetch/overview.html "You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 10 seconds for online requests and 10 minutes for offline requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline." The solution would be to extend SimpleClientHttpRequestFactory, but there doesn't appear to be a simple way to inject it. Perhaps allowing the user to provide their own ClientHttpRequestFactorySelector as a Spring bean might be a solution? This is what I need: {code} public class GAESimpleClientHttpRequestFactory extends SimpleClientHttpRequestFactory { @Override protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { connection.setConnectTimeout(10); connection.setReadTimeout(10); super.prepareConnection(connection, httpMethod); } } {code} This is the pain I am experiencing: Twitter: {code} Caused by: org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate. java:213) at org.springframework.social.twitter.api.impl.UserTemplate.getUserProfile(UserTemplate.java:54) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:42) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:30) at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:172) at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:135) at org.springframework.social.connect.support.OAuth1Connection.(OAuth1Connection.java:57) at org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59) at org.springframework.social.connect.web.ConnectController.oauth1Callback(ConnectController.java:160) {code} Facebook: {code} org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://graph.facebook.com/me; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:170) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:41) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:37) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30) {code}
    via by Scott Murphy,
  • This is a major problem on Google App Engine. I am periodically getting exceptions using twitter and facebook. I need to be able to change the default timeout on a request from 5 (default) to 10 seconds. http://code.google.com/appengine/docs/java/urlfetch/overview.html "You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 10 seconds for online requests and 10 minutes for offline requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline." The solution would be to extend SimpleClientHttpRequestFactory, but there doesn't appear to be a simple way to inject it. Perhaps allowing the user to provide their own ClientHttpRequestFactorySelector as a Spring bean might be a solution? This is what I need: {code} public class GAESimpleClientHttpRequestFactory extends SimpleClientHttpRequestFactory { @Override protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { connection.setConnectTimeout(10); connection.setReadTimeout(10); super.prepareConnection(connection, httpMethod); } } {code} This is the pain I am experiencing: Twitter: {code} Caused by: org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://api.twitter.com/1/account/verify_credentials.json at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate. java:213) at org.springframework.social.twitter.api.impl.UserTemplate.getUserProfile(UserTemplate.java:54) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:42) at org.springframework.social.twitter.connect.TwitterAdapter.setConnectionValues(TwitterAdapter.java:30) at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:172) at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:135) at org.springframework.social.connect.support.OAuth1Connection.(OAuth1Connection.java:57) at org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59) at org.springframework.social.connect.web.ConnectController.oauth1Callback(ConnectController.java:160) {code} Facebook: {code} org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://graph.facebook.com/me; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:170) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:41) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:37) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30) {code}
    via by Scott Murphy,
  • Here is steps required to reproduce the issue 1. Login with facebook account manually from browser. 2. Access facebook application from facebook account. 3. Create connection using data retrieved from signed_request parameter using spring-social-facebook. 4. Store connection in repository. 5. Logout from facebook manually from browser. 6. Login again with same user. 7. Open facebook application again from browser. 8. This time application tries to use connection retrieved from repository which has already logged out and tries to check connection state with Connection.test method and get following exception which I think is not correct handling for this case: org.springframework.web.client.ResourceAccessException: I/O error: Server returned HTTP response code: 401 for URL: https://graph.facebook.com/me; nested exception is java.io.IOException: Server returned HTTP response code: 401 for URL: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:173) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:43) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:39) at org.springframework.social.facebook.connect.FacebookAdapter.test(FacebookAdapter.java:34) at org.springframework.social.facebook.connect.FacebookAdapter.test(FacebookAdapter.java:30) at org.springframework.social.connect.support.AbstractConnection.test(AbstractConnection.java:97) at com.social.controller.FacebookConnectController.getPost(FacebookConnectController.java:105) at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
    via by Alexander Nalbandyan,
  • Spring 3 | Develop and Conquer
    via by Unknown author,
    • org.springframework.web.client.ResourceAccessException: I/O error: Timeout while fetching: https://graph.facebook.com/me; nested exception is java.net.SocketTimeoutException: Timeout while fetching: https://graph.facebook.com/me at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:170) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:41) at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:37) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42) at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    stigkjstigkj
    2 times, last one,
    tvrmsmithtvrmsmith
    1 times, last one,
    wendellpereirawendellpereira
    4 times, last one,
    11 more bugmates