401: authentication credentials were missing or incorrect


#1

I All, i try make Twitter4j running with java.
I already use 3.0.3 twitter4j versione and using Textpad for write the program.

I need to do a simple search of tweets but. something go wrong with the authentication. I’ll try to recreate token but still not working.

ill post here my programm and the error;

package twitter4j.examples.search;
import twitter4j.QueryResult;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.TwitterResponse;
import twitter4j.auth.AccessToken;
import twitter4j.auth.RequestToken;
import twitter4j.api.;
import twitter4j.auth.OAuthSupport;
import java.io.
;
import java.util.logging.Logger;
import java.util.List;

import twitter4j.*;
import twitter4j.Query;

/**
 * Twitter application using Twitter4J
 */
public class mytwitter {  //this the file name of main class
    private final Logger logger = Logger.getLogger(mytwitter.class.getName());

    public static void main(String[] args) {
        new mytwitter().retrieve();
    }

    public void retrieve() {
        logger.info("Retrieving tweets...");
        Twitter mytwitter  = new TwitterFactory().getInstance();

		        String keyWord = "Traffico";
		        Query query = new Query(""+keyWord);
		    	query.setCount(100);
		    	query.setLang("Italian");
		        query.setSince("2013-04-01");
		        //query.setUntil("2011-01-01");
		        try {

		            QueryResult result = mytwitter.search(query);
		            List<Status> tweets = result.getTweets();
		            System.out.println("Count : " + result.getTweets().size()) ;

		            for (Status tweet: tweets) {
		                System.out.println(tweet.getId() + " - " + tweet.getCreatedAt() + " - " + tweet.getText()+ ": ");
            }
        } catch (TwitterException e) {
            e.printStackTrace();
        }
        logger.info("done! ");
    }
}

The Error:

401: Authentication credentials (http://devtwitter.com/pages/auth) were missing or incorrect. Ensure yuo have set valid consumer key/secret, access token/secret, and the system clock is sinc

message - invalid or expired token
code -89
version 3.0.3
.</code>

Pls, someone HELP ME. 

regards, Fabio