开发者

Please help = Found interface twitter4j.User, but class was expected on GAE/J

I am using twitter4j-core-2.1.2.jar.

Following is my code which executed after callback url hit.

Code

    String token = (String) session.getAttribute("token");
String tokenSecret = (String)session.getAttribute("tokenSecret");

AccessToken accessToken =   new AccessToken(token, tokenS开发者_Go百科ecret);

Twitter twitter = new
TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY,CONSUMER_SECRET,accessToken);

// getting exception on this line.

User user = twitter.verifyCredentials(); 

Follwowing is the exception

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

Please help. I am stuck on it.


Status code 401 typically indicates a problem with credentials on the Twitter server, in this case while the server is trying to verify the user using the supplied credentials. Are you sure all the values you're passing are valid values (token or tokenSecret aren't null perhaps)?


I just ran into this problem. The issue was that I had two different Twitter4J library jars in my WEB-INF/lib folder. I removed one, restarted, and everything worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜