我正在使用restFB API运行一个简单的代码,在我创建令牌访问之后,程序正在运行,从我的Facebook帐户中检索数据,但过了一会儿我收到了这条异常消息
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: Error validating access token: Session has expired at unix time 1376380800. The current unix time is 1376392638.
at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:766)
at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:688)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:630)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:592)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:556)
at com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:244)
at Example.main(Example.java:19)
我运行的产生上述异常的代码如下:
public static void main(String[] args) {
FacebookClient facebookClient = new DefaultFacebookClient("Token_Access_Code");
User user = facebookClient.fetchObject("me", User.class);
Page page = facebookClient.fetchObject("cocacola", Page.class);
System.out.println("User name: " + user.getName());
System.out.println("Page likes: " + page.getLikes());
}
有没有人经历过这样的异常?