Announcement Announcement Module
Collapse
No announcement yet.
Facing Connection Issue while OAuth dance Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Facing Connection Issue while OAuth dance

    Hi,

    I am using Spring Social Facebook to integrate my application with Facebook. I am using ConnectController for the OAuth dance process.

    The user gets authenticated properly, after that user is promprted for access permissions, the user is able to submit the request.

    ConnectController is recieving the response back with the "code" as a parameter. AFter it, the application tries to authorize itself using OAuth2Callback as expected.

    The issue occrs at this time. It gives "Connection refused from https://graph.facebook.com/oauth/aurthoize". it says Connection timeout.

    When I generated the url manually & tried to do a GET request, I was got the accessToken as expected.

    Please let me know how to resolve this timeout issue.

    Thanks.

  • #2
    I'm not entirely sure what's going on here. I just tried it with the Spring Social Showcase (and it worked fine). One thing that stands out to me is that you say you go through almost all of the OAuth 2 dance and after that it complains about the /oauth/authorize endpoint. This endpoint is the one that you are redirected to when you do the user authorization, so it's odd that it'd complain about it at this point.

    (I also noticed that you said the URL was https://graph.facebook.com/oauth/aurthoize, which is incorrect...notice the spelling of "aurthoize". Not sure if this is a typo here in the forum or if there's something in your code that actually has that URL.)

    Can you share anything about your social configuration or the authorization-related code that might explain why you're seeing a complaint about the authorization URL at the point in the flow when it should be going to the /oauth/access_token URL? Also, have you tried and looked at the code for the Spring Social Showcase to see if (1) you've got a similar configuration and (2) to ensure that it works for you.

    Comment


    • #3
      HI,

      I am using XML to configure my beans. here the the relevant beans I am using :

      Code:
      <bean id="connectionFactoryLocator" class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
      	<property name="connectionFactories">
      		<list>
      			<bean class="uk.co.airmiles.web.mvc.controller.facebook.CustomFacebookConnectionFactory">
      				<constructor-arg value="296016853788370" ></constructor-arg>
      				<constructor-arg value="4addd8e6d29959a0fefd275ec6aaf58a" ></constructor-arg>
      			</bean>
      		</list>
      	</property>
      </bean>
        
      <bean id="usersConnectionRepository" class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository">
      <constructor-arg ref="dataSource" />
      <constructor-arg ref="connectionFactoryLocator" />
      <constructor-arg ref="textEncryptor" />
      </bean>
      
      <!--  Embedded database for storing connections   --> 
       <jdbc:embedded-database id="dataSource" type="H2">
        <jdbc:script location="classpath:/org/springframework/social/connect/jdbc/JdbcUsersConnectionRepository.sql" /> 
        </jdbc:embedded-database>
      
      <bean id="connectionRepository" factory-method="createConnectionRepository"
      factory-bean="usersConnectionRepository" scope="request">
      <constructor-arg value="#{request.userPrincipal.name}" />
      <aop:scoped-proxy proxy-target-class="false" />
      </bean>
      
      <bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"
      factory-method="noOpText" />
      NOTE : i have used some Custom..... classes using Springsource code only to use debug to solve the code.


      Here are the logs stating my issue :

      Code:
      xxx.web.mvc.controller.facebook.CustomConnectController.oauth2Callback(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
      xxx.web.mvc.controller.facebook.CustomConnectController  Enter oauth2Callback
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter completeConnection
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter callbackUrl
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Exit callbackUrl
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-xxx.web.mvc.controller.facebook.CustomFacebookOAuth2Template sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter postForAccessGrant
      sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter prepareConnection
      sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Exit prepareConnection
      sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Invoking request handler method: public org.springframework.web.servlet.view.RedirectView xxx.web.mvc.controller.facebook.CustomConnectController.oauth2Callback(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
      xxx.web.mvc.controller.facebook.CustomConnectController sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter oauth2Callback
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter completeConnection
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter callbackUrl
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Exit callbackUrl
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - code :: AQAoGTuk2C9E7nebXGL0dT3Sp_Sd3JKmsYJ0DEtwc2wgn2kC0jl8N3lsNmwWRFeB2zW_4jDOHo2hFB0uGxyoXl0owWrTS1XlJnlhpxSkL9FMLUXgrg6m4Iv6Gr8KSgUHKkB2ianHhoiV54HTgcuQTU_tdKc8HJaSckm2_JRI3sKumpXy42s66fMeGNJk4k6rdWc ::: callbackUrl :: https://localhost.myapp.com/connect/facebook
      xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter callbackUrl
      2012-02-17 07:37:08,089 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomConnectSupport sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Exit callbackUrl
      xxx.web.mvc.controller.facebook.CustomFacebookOAuth2Template sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Enter postForAccessGrant
      
      1509990834!1329464150526 - Created GET request for "https://graph.facebook.com/oauth/access_token?client_id=296016853788370&redirect_uri=https://localhost.myapp.com/connect/facebook&client_secret=4addd8e6d29959a0fefd275ec6aaf58a&code=AQAoGTuk2C9E7nebXGL0dT3Sp_Sd3JKmsYJ0DEtwc2wgn2kC0jl8N3lsNmwWRFeB2zW_4jDOHo2hFB0uGxyoXl0owWrTS1XlJnlhpxSkL9FMLUXgrg6m4Iv6Gr8KSgUHKkB2ianHhoiV54HTgcuQTU_tdKc8HJaSckm2_JRI3sKumpXy42s66fMeGNJk4k6rdWc"
      
      org.springframework.web.client.RestTemplate sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Setting request Accept header to [application/x-www-form-urlencoded, multipart/form-data]
      2012-02-17 07:37:08,636 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - WARN  xxx.web.mvc.controller.facebook.CustomConnectController sessionId=v2bfP2DWxyfBxQhNQs2jpllVhYXChZwXsRPRN6NJ30kMtP8x8QDy!-1509990834!1329464150526 - Exception while handling OAuth2 callback (I/O error: connect timed out; nested exception is java.net.SocketTimeoutException: connect timed out). Redirecting to facebook connection status page
      Last edited by habuma; Feb 17th, 2012, 09:31 AM.

      Comment


      • #4
        Note : My application uses Apache Web Server for url rewriting purpose & prepends /spring for web module using Spring MVC.

        When i directly hit the browser with the url :
        https://graph.facebook.com/oauth/acc...70&redirect_ur i=https://localhost.myapp.com/connect/facebook&client_secret=4addd8e6d29959a0fefd275ec6a af58a&code=AQAoGTuk2C9E7nebXGL0dT3Sp_Sd3JKmsYJ0DEt wc2wgn2kC0jl8N3lsNmwWRFeB2zW_4jDOHo2hFB0uGxyoXl0ow WrTS1XlJnlhpxSkL9FMLUXgrg6m4Iv6Gr8KSgUHKkB2ianHhoi V54HTgcuQTU_tdKc8HJaSckm2_JRI3sKumpXy42s66fMeGNJk4 k6rdWc

        I got the access token in the browser.

        SO I feel that there area I am making mistake is "redirect_uri" . But I could nt exactly figure out what exactly I should do.
        IN my ConnectController, I have set the property "applicationUrl" as "https://localhost.myapp.com/connect/facebook"
        Last edited by jubin.juneja; Feb 17th, 2012, 04:11 AM.

        Comment


        • #5
          Also, please let me know while creating application on Facebook site, what all things I need to specify., i.e. siteUrl...???

          Thanks for your help Sir.

          Comment


          • #6
            I'm still not sure what's going on (there's a lot of good info here that I still need to think through), but a couple of quick thoughts...

            - If your Apache server prepends "spring", then shouldn't your redirect_uri be "https://localhost.myapp.com/spring/connect/facebook"? (Both in your Spring Social config and in your application's Facebook registration.)
            - If you're getting the redirect_uri wrong, I wouldn't think you'd get a connection timeout...I'd expect an HTTP 400 or some such thing from Facebook indicating that the request was invalid.
            - Also, if you're getting the redirect_uri wrong, then how is what you did in the browser different from what Spring Social did? With a manual comparison, the URLs look the same to me.
            - I don't think this has anything to do with it, but...you do have https turned on for localhost.myapp.com, don't you? Again, probably unrelated--but thought I'd ask.

            As for configuration details in Facebook, I believe that you only need to answer the basic info questions and also check the "Website" checkmark and fill in the "Site URL" field with the root URL of your application. For Spring Social Showcase, that info is:

            - App Display Name: Spring Social Showcase
            - App Namespace: socialshowcase
            - Contact Email: ...my email...
            - App Domain: ...left blank...
            - Category: Other
            - Website -> Site URL: http://localhost:8080/spring-social-showcase/

            Given what you've told me, I'd expect that your Site URL: would look something like: https://localhost.app.com/spring/ (note that the trailing slash is significant to Facebook).

            And, I gotta ask it again: Have you tried running the Spring Social Showcase? Does it work? I ask because I know it works for me and most others. If it's not working for you, then there might be an environment issue in play. If it does work for you, then it's likely an app issue on your end. Trying it out might help pinpoint where the issue is in your code.

            One more thing: Is this project in GitHub or somewhere public where I can pull it and try to run it myself? No big deal if it isn't, but if it is then it'd be helpful for me to share in the debugging.

            Comment


            • #7
              Also, I don't see your ConnectController declaration among the beans you gave...can you show me that, too?

              Comment


              • #8
                The exact point where my code breaks is is :
                org.springframework.web.client.RestTemplate.doExec ute(RestTemplate.java:443)
                at org.springframework.web.client.RestTemplate.execut e(RestTemplate.java:401)
                at org.springframework.web.client.RestTemplate.postFo rObject(RestTemplate.java:279)
                at org.springframework.social.facebook.connect.Facebo okOAuth2Template.postForAccessGrant(FacebookOAuth2 Template.java:57)
                at org.springframework.social.oauth2.OAuth2Template.e xchangeForAccess(OAuth2Template.java:104)
                at org.springframework.social.connect.web.ConnectSupp ort.completeConnection(ConnectSupport.java:124)

                I have customized ConnectController, & it is annotated with @Controller, so it wasnt present in xml bean def.

                1 error, I made was in Facebook, my site URL was not ending with trailing with '/' . That i corrected as mentioned by u.
                But still, I am facing the same issue. Its 3 days now. I am struck at same point.

                Can the issue be as my project uses Spring web 3.0.5 web version...so coz of some conflict??

                My project is not on github.

                Comment


                • #9
                  Hi,

                  I am also facing similar issue, when I hard coded "accesstoken" to recieve friends list.

                  Here is my FacebookHomeController :

                  @Controller
                  public class FacebookHomeController {

                  private Facebook facebook;

                  public FacebookHomeController() {
                  }

                  @RequestMapping(value = "/facebook/friends", method = RequestMethod.GET)
                  public String home(Model model) {
                  this.facebook = new FacebookTemplate("AAAENOctq5tIBAFNBmq93xrrkKpCl1ZB WZAuVLa2h2Xatg8nVYPiqd4eKQywLvfr58XBPtCHqLZAUjDh3g ZBxW7XJTklCBrL807M6qnEIYAZDZD");

                  List<Reference> friends = this.facebook.friendOperations().getFriends();
                  model.addAttribute("friends", friends);
                  return "home";

                  }
                  }

                  Now , I tried Site URL as : https://localhost.myapp.com/ ; http://localhost.myapp.com/ ; https://localhost.myapp.com/spring/ ; http://localhost.myapp.com/spring

                  Comment


                  • #10
                    Now following are the logs describing the error :

                    Code:
                    sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Request: FilterInvocation: URL: /facebook/friends?; ConfigAttributes: [REQUIRES_SECURE_CHANNEL_FOR_LOGGED_IN_USER]
                    2012-02-18 15:30:16,179 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG 
                    
                    DispatcherServlet with name 'dispatcher-servlet' processing GET request for [/spring/facebook/friends]
                    2012-02-18 15:30:16,179 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Mapping [/facebook/friends] to HandlerExecutionChain with handler xxx.web.mvc.controller.facebook.FacebookHomeController@bdd443] and 1 interceptor
                    2012-02-18 15:30:16,179 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG org.springframework.web.servlet.DispatcherServlet sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Last-Modified value for [/spring/facebook/friends] is: -1
                    /spring/facebook/friends called 
                    
                    2012-02-18 15:30:16,179 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG org.springframework.web.bind.annotation.support.HandlerMethodInvoker sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Invoking request handler method: public java.lang.String xxx.web.mvc.controller.facebook.FacebookHomeController.home(org.springframework.ui.Model)
                    2012-02-18 15:30:16,241 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG org.springframework.web.client.RestTemplate sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Created GET request for "https://graph.facebook.com/me/friends"
                    2012-02-18 15:30:16,241 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG org.springframework.web.client.RestTemplate sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Setting request Accept header to [application/json]
                    2012-02-18 15:30:16,960 [pool-1-thread-1] - DEBUG 
                    2012-02-18 15:30:37,147 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.servlet.handler.MappingExceptionResolver sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Resolving exception from handler [xxx.web.mvc.controller.facebook.FacebookHomeController@bdd443]: org.springframework.web.client.ResourceAccessException: I/O error: Connection to https://graph.facebook.com refused; nested exception is org.apache.http.conn.HttpHostConnectException: Connection to https://graph.facebook.com refused
                    2012-02-18 15:30:37,147 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.servlet.handler.MappingExceptionResolver 
                    sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Enter logException
                    2012-02-18 15:30:37,147 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - WARN  debug sessionId=9H40P12RwHZ5VnBSXLwQTvXDFg0rchSZ3z5kHwMXJjGZlpN0VfSs!-1143151408!1329577617101 - Handler execution resulted in exception
                    org.springframework.web.client.ResourceAccessException: I/O error: Connection to https://graph.facebook.com refused; nested exception is org.apache.http.conn.HttpHostConnectException: Connection to https://graph.facebook.com refused
                    	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                    	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                    	at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                    	at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:180) ~[spring-social-facebook-1.0.0.RELEASE.jar:na]
                    	at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:174) ~[spring-social-facebook-1.0.0.RELEASE.jar:na]
                    	at org.springframework.social.facebook.api.impl.FriendTemplate.getFriends(FriendTemplate.java:104) ~[spring-social-facebook-1.0.0.RELEASE.jar:na]
                    	at org.springframework.social.facebook.api.impl.FriendTemplate.getFriends(FriendTemplate.java:91) ~[spring-social-facebook-1.0.0.RELEASE.jar:na]
                    	at xxx.web.mvc.controller.facebook.FacebookHomeController.home(FacebookHomeController.java:37) ~[FacebookHomeController.class:na]
                    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_05]
                    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_05]
                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_05]
                    	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_05]
                    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) ~[org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                    	at
                    Last edited by habuma; Feb 20th, 2012, 04:15 PM.

                    Comment


                    • #11
                      Code:
                      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) ~[org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) [org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) [org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) [org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) [org.springframework.web.servlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet_1.0.0.0_2-5.jar:2.5]
                      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) [javax.servlet_1.0.0.0_2-5.jar:2.5]
                      	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) [weblogic.jar:10.3.0.0]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:366) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167) [org.springframework.security.web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
                      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) [org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                      	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) [weblogic.jar:10.3.0.0]
                      	at uk.co.airmiles.web.utils.filter.CheckSessionCookieEnabledFilter.doFilter(CheckSessionCookieEnabledFilter.java:61) [web-utils-2.0-SNAPSHOT.jar:na]
                      	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) [weblogic.jar:10.3.0.0]
                      	at uk.co.airmiles.web.utils.filter.BookingJourneyFlowFilter.doFilter(BookingJourneyFlowFilter.java:91) [web-utils-2.0-SNAPSHOT.jar:na]
                      	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) [weblogic.jar:10.3.0.0]
                      	at uk.co.airmiles.web.utils.filter.LogDiagnosticContextFilter.doFilter(LogDiagnosticContextFilter.java:49) [web-utils-2.0-SNAPSHOT.jar:na]
                      	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496) [weblogic.jar:10.3.0.0]
                      	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [com.bea.core.weblogic.security.identity_1.1.0.0.jar:1.1.0.0]
                      	at weblogic.security.service.SecurityManager.runAs(Unknown Source) [com.bea.core.weblogic.security.wls_1.0.0.0_5-0-2-0.jar:5.0.2.0]
                      	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086) [weblogic.jar:10.3.0.0]
                      	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406) [weblogic.jar:10.3.0.0]
                      	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) [com.bea.core.weblogic.workmanager_1.4.0.0.jar:1.4.0.0]
                      	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) [com.bea.core.weblogic.workmanager_1.4.0.0.jar:1.4.0.0]
                      Caused by: org.apache.http.conn.HttpHostConnectException: Connection to https://graph.facebook.com refused
                      	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:127) ~[httpclient-4.0.jar:4.0]
                      Last edited by habuma; Feb 20th, 2012, 04:16 PM.

                      Comment


                      • #12
                        Code:
                        at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:101) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554) ~[httpclient-4.0.jar:4.0]
                        	at org.springframework.social.support.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:81) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.social.support.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:91) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.social.oauth2.OAuth2RequestInterceptor.intercept(OAuth2RequestInterceptor.java:45) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:81) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:67) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.social.support.BufferingClientHttpRequest.executeInternal(BufferingClientHttpRequest.java:57) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.social.support.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:91) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.social.oauth2.OAuth2RequestInterceptor.intercept(OAuth2RequestInterceptor.java:45) ~[spring-social-core-1.0.0.RELEASE.jar:na]
                        	at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:81) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:67) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:438) ~[org.springframework.web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                        	... 61 common frames omitted
                        Caused by: java.net.ConnectException: Connection timed out: connect
                        	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.6.0_05]
                        	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) ~[na:1.6.0_05]
                        	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) ~[na:1.6.0_05]
                        	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) ~[na:1.6.0_05]
                        	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) ~[na:1.6.0_05]
                        	at java.net.Socket.connect(Socket.java:519) ~[na:1.6.0_05]
                        	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550) ~[na:1.6]
                        	at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:333) ~[httpclient-4.0.jar:4.0]
                        	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123) ~[httpclient-4.0.jar:4.0]
                        	... 86 common frames omitted
                        Can you make out now what the issue can be????
                        Last edited by habuma; Feb 20th, 2012, 04:17 PM.

                        Comment


                        • #13
                          Hi Sir,

                          I customized several spring files to run in Debug mode to find exact point of error.

                          Following error i recieved :
                          Code:
                          Class : SimpleClientHttpRequest (of spring framework)
                          protected ClientHttpResponse executeInternal(HttpHeaders headers, ByteArrayOutputStream byteArrayOutputStream) throws IOException {
                          		for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
                          			String headerName = entry.getKey();
                          			for (String headerValue : entry.getValue()) {
                          				this.connection.addRequestProperty(headerName, headerValue);
                          			}
                          		}
                          		this.connection.connect();
                          		if (byteArrayOutputStream.toByteArray().length > 0) {
                          			FileCopyUtils.copy(byteArrayOutputStream.toByteArray(), connection.getOutputStream());
                          		}
                          		return new SimpleClientHttpResponse(this.connection);
                          	}
                          
                          My code terminates at line : this.connection.connect(); giving an error :
                          com.sun.jdi.InternalException : Get error code in reply :35 occured retrieving 'this' from stack frame
                          
                          Other logs for your reference :
                          sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Enter checkExecuted
                          2012-02-20 04:00:49,288 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomSimpleClientHttpRequest sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Exit checkExecuted
                          2012-02-20 04:00:49,288 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomSimpleClientHttpRequest sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Enter executeInternal
                          2012-02-20 04:00:49,725 [[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomSimpleClientHttpRequest sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Exception thrown in executeInternal: java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443
                          2012-02-20 04:00:49,725 [[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomSimpleClientHttpRequest sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Exception thrown in execute: java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443
                          2012-02-20 04:00:49,725 [[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] - DEBUG xxx.web.mvc.controller.facebook.CustomRestTemplate sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Exception thrown in doExecute: org.springframework.web.client.ResourceAccessException: I/O error: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443; nested exception is java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443
                          2012-02-20 04:00:49,725 [[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] - WARN  xxx.web.mvc.controller.facebook.CustomConnectController sessionId=L4qTPBCJbpFpqFCFc1pLdpzjJNZ1Hd6QpZxhpQMzR1bbpkqVWWnF!1870199365!1329709673343 - Exception while handling OAuth2 callback (I/O error: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443; nested exception is java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: graph.facebook.com port: 443). Redirecting to facebook connection status page.
                          Please help me Sir. Its 6 days, I am struck with this issue

                          Waiting for your reply... Thanks
                          Last edited by habuma; Feb 20th, 2012, 04:18 PM.

                          Comment


                          • #14
                            Well, the things in that long stack trace (the one where you're fetching friends with a hard-coded access token) that stand out to me are the parts that say "java.net.ConnectException: Connection timed out: connect" and "Caused by: org.apache.http.conn.HttpHostConnectException: Connection to https://graph.facebook.com refused". This tells me that there was some some trouble connecting to https://graph.facebook.com. But why? I don't know.

                            My guess is that whatever it is would also be the cause of the problem you originally described.

                            Connection problems like that could be a number of things. You might get that if graph.facebook.com is down--not likely, although it has happened a few times. More likely there's a network problem on your end that prevents your app from accessing https://graph.facebook.com. Could be a proxy issue, or some goofy DNS issue...there's no way for me to know for sure.

                            But let's try a simple test to diagnose it. Try running the following 3 lines of code (in a main method or test method):

                            Code:
                            RestTemplate rest = new RestTemplate();
                            String result = rest.getForObject("https://graph.facebook.com/738140579", String.class);
                            System.out.println(result);
                            Ideally, run this from the same machine you were getting the errors from. If this is a network problem as I suspect, you should get a similar exception from these 3 lines as you got from your app. If not, then you should see a few bits of info from my Facebook profile.

                            Comment


                            • #15
                              Thanks a lot Sir, I will be checking this & post the result on this thread. Personally, I also came to this conclusion yesterday.

                              One observation. When you asked me running spring-social-shocase project on my system, I wasent able to do so as I was facing some build issues.
                              Anyhow, when I tried running the spring-social-showcase at my home, I was able to run it successfully, whereas when I tried that running in this env & ran on Tomcat server, co-incidencely I got the same error message "I/O error, connection timed out" & that too after getting the user verification, means while getting access token. SO it seems this should solve my issue.

                              If not, I will again get back to you.

                              Thanks a lot sir for your help

                              Comment

                              Working...
                              X