I am using twitter4j .
Even though I have added the consumer key ,secret key in the configuration i get the 401 error. But the same configuration file is working good for the following
TwitterFactory twitterFactory = new TwitterFactory(configuration);
Twitter twitterClient = twitterFactory.getInstance();
but not working for the
TwitterStreamFactory twitterStreamFactory = new TwitterStreamFactory(configuration);
TwitterStream twitterStreamClient = twitterStreamFactory.getInstance();
FilterQuery filterQuery = new FilterQuery(followersId);
twitterStreamClient.addListener(statusListener);
twitterStreamClient.filter(filterQuery);
i got the error as
[Twitter Stream consumer-1[Establishing connection]] INFO - 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.
Error 401 Unauthorized
HTTP ERROR: 401
Problem accessing '/1.1/statuses/filter.json'. Reason:
Unauthorized
When i print the System.out.println(twitterStreamClient.getOAuthAccessToken().getTokenSecret()); it shows the accesstoken secret value. I am confused with this. Anyone can help me?