TWITTER4J illegalstate - pair already set


I registered my application r/w and see CONSUMER KEY + SECRET. I’m
attempting to get ACCESS TOKEN for another user to this application
(not the user I used to create the application) #7 DOESN’T WORK for me…

If I use it w/o modification when I get to:
twitter.setOAuthConsumer("[consumer key]", “[consumer secret]”);
java.lang.IllegalStateException: consumer key/secret pair already set.

WHICH I haven’t done anything to set state here or previously logged
in (also my IE and FF browsers aren’t logged in)… and there is not file in my directory or path…

if I use ConfigurationBuilder to build the Access Tokens, like:

ConfigurationBuilder cb = new ConfigurationBuilder();
if (access_token != null && access_secret != null) {
TwitterFactory tf = new TwitterFactory(;
Twitter twitter = tf.getInstance();

I get past the problem, however - I then get problem on LINE
RequestToken requestToken = twitter.getOAuthRequestToken();

IllegalStateException: Access token already available.

After looking extensively on internet, I can’t find a solution for

Any ideas?



I assume that you’re already specifying the consumer key/secret in
And you cannot overwrite consumer key/secret of a particular Twitter instance.


i have same issue ?


i have same issue


i m facing with same issue


can anyone post solution ??