私は資格情報が期待どおりに動作します有効であれば、Twitterの資格情報がtwitter4jTwitter4Jは、資格情報とキャッチエラー
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
String Test = "Testing Twitter4J";
try {
ConfigurationBuilder confbuilder = new ConfigurationBuilder();
confbuilder.setOAuthAccessToken("A")
.setOAuthAccessTokenSecret("B")
.setOAuthConsumerKey("C")
.setOAuthConsumerSecret("D");
Twitter twitter = new TwitterFactory(confbuilder.build()).getInstance();
//Status status = twitter.updateStatus("Working lunch today");
User user = twitter.verifyCredentials();
Test = "Successfully updated the status to [" + user.getScreenName() + "].";
} catch (TwitterException e) {
Test = "no";
}
try {
resp.getOutputStream().write(Test.getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
を使用して有効であるかどうかをテストするには、GoogleのAppEngineの上で次のコードを持っていることを確認します。 「ユーザーのユーザー= twitter.verifyCredentials();」から
Uncaught exception from servlet
twitter4j.TwitterRuntimeException: 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
message - Invalid or expired token
code - 89
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=93f2523c or
http://www.google.co.jp/search?q=8b74a4e3
TwitterException{exceptionCode=[93f2523c-8b74a4e3], statusCode=401, message=Invalid or expired token, code=89, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
:クレデンシャルが有効でないので、私はアクセスを取り消す場合は、私はApp Engineのエラーを取得しますライン。私はjavadocからTwitterExceptionがスローされることを期待していました: http://twitter4j.org/javadoc/twitter4j/api/UsersResources.html#verifyCredentials() しかし、TwitterRuntimeExceptionが表示されるようです。どうして?私はjavadocsでTwitterRuntimeExceptionのメモを見つけることができません。
Hiii ,,,,あなたはその解決策を見つけましたか? @マイケル.. –
は何か解決策を見つけましたか? –