Twitter integration:consumer key/secret pair already set

Viewed 11886

Trying to integrate my webapp with Twitter using twitter4j lib.
I have registered my app on twitter site and got Consumer key and Consumer secret values.
Nothing special,standard OAuth step.

code:

public class TwitterService {
    private final String CONSUMER_KEY = "xxx";
    private final String CONSUMER_SECRET = "yyy";

    public String fav() {
        Twitter twitter = TwitterFactory.getSingleton();
        twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
...

exception:

Caused by: java.lang.IllegalStateException: consumer key/secret pair already set.

I have no more configuration for key and secret,any .properties or other file.

EDIT:

commenting line twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); causes exception:

java.lang.IllegalStateException: OAuth consumer key/secret combination not supplied
2 Answers
Related