我正在使用 twitter4j-core-2.1.2.jar。
以下是我在回调 url 命中后执行的代码。
代码
String token = (String) session.getAttribute("token");
String tokenSecret = (String)session.getAttribute("tokenSecret");
AccessToken accessToken = new AccessToken(token, tokenSecret);
Twitter twitter = new
TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY,CONSUMER_SECRET,accessToken);
// getting exception on this line.
User user = twitter.verifyCredentials();
以下是例外
java.lang.IncompatibleClassChangeError: Found interface twitter4j.User, but class was expected
at com.thefollowfriday.servlet.HomeServlet.doGet(HomeServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
Reason: TwitterException{statusCode=401, retryAfter=0,
rateLimitStatus=null} at
twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:
301) at
twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:
68) at
twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:
90) at twitter4j.Twitter.verifyCredentials(Twitter.java:1134) at
com.thefollowfriday.servlet.HomeServlet.doGet(HomeServlet.java:68) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:693) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at
请帮忙。我坚持下去。