I created an APP in twitter; I gave it Read/write access, and then regenerated keys (accessToken,accessTokenSecret,consumerSecret.consumerKey}.
I put the values into twitter4j.properties file; and then wrote a demo Status Listener. and when I run it I get: “User not in role”
Code:
TwitterStream twitterStream=new TwitterStreamFactory().getInstance();
StatusListener listener = new StatusListener() {
public void onStatus(Status status) {
System.out.println("@" + status.getUser().getScreenName() +
" - " + status.getText());
}
public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
System.out.println("Got a status deletion notice id:" +
statusDeletionNotice.getStatusId());
}
public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
System.out.println("Got track limitation notice:" +
numberOfLimitedStatuses);
}
public void onScrubGeo(long userId, long upToStatusId) {
System.out.println("Got scrub_geo event userId:" + userId +
" upToStatusId:" + upToStatusId);
}
public void onException(Exception ex) {
ex.printStackTrace();
}
};
twitterStream.addListener(listener);
twitterStream.firehose(0);
ERROR:
[Fri Jul 29 11:30:08 PDT 2011]Will use class twitter4j.internal.logging.StdOutLoggerFactory as logging factory.
[Fri Jul 29 11:30:08 PDT 2011]Will use twitter4j.internal.http.HttpClientImpl as HttpClient implementation.
[Fri Jul 29 11:30:08 PDT 2011]Establishing connection.
[Fri Jul 29 11:30:08 PDT 2011]Twitter Stream consumer-1[Establishing connection]
[Fri Jul 29 11:30:08 PDT 2011]Request:
[Fri Jul 29 11:30:08 PDT 2011]POST http://stream.twitter.com/1/statuses/firehose.json
[Fri Jul 29 11:30:08 PDT 2011]OAuth base string: POST&http%3A%2F%2Fstream.twitter.com%2F1%2Fstatuses%2Ffirehose.json&count%3D0%26oauth_consumer_key%3D6ybyJFQFSdNjfg3bn5dMQ%26oauth_nonce%3D2866835517%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1311964208%26oauth_token%3D344120042-FJLlAVvdUG04Gn3GPwuugWoaB34rrLQULYSAkqYX%26oauth_version%3D1.0
[Fri Jul 29 11:30:08 PDT 2011]OAuth signature: OKLbKopSAGQBmtwI05bBFk3F5Ko=
[Fri Jul 29 11:30:08 PDT 2011]Authorization: *******************************************************************************************************************************************************************************************************************************************************************************
[Fri Jul 29 11:30:08 PDT 2011]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-2.2.3.xml
[Fri Jul 29 11:30:08 PDT 2011]X-Twitter-Client: Twitter4J
[Fri Jul 29 11:30:08 PDT 2011]Accept-Encoding: gzip
[Fri Jul 29 11:30:08 PDT 2011]User-Agent: twitter4j http://twitter4j.org/ /2.2.3
[Fri Jul 29 11:30:08 PDT 2011]X-Twitter-Client-Version: 2.2.3
[Fri Jul 29 11:30:08 PDT 2011]Post Params: count=0
[Fri Jul 29 11:30:08 PDT 2011]Response:
[Fri Jul 29 11:30:08 PDT 2011]HTTP/1.1 403 Forbidden
[Fri Jul 29 11:30:08 PDT 2011]Transfer-Encoding: chunked
[Fri Jul 29 11:30:08 PDT 2011]Content-Type: text/html; charset=iso-8859-1
[Fri Jul 29 11:30:08 PDT 2011]Server: Jetty(6.1.25)
[Fri Jul 29 11:30:08 PDT 2011]User not in role
[Fri Jul 29 11:30:08 PDT 2011]403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (http://support.twitter.com/forums/10711/entries/15364).
User not in role
[Fri Jul 29 11:30:08 PDT 2011]This account is not in required role. 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (http://support.twitter.com/forums/10711/entries/15364).
User not in role
Process exited.
Debugger disconnected from local process.