1
votes

I have a java program for fetching my tweets and below is the code

public class TwitterTest {
    public static void main(String[] args) {
        Twitter twitter = new TwitterFactory().getInstance();

        //  My Applications Consumer and Auth Access Token
        //twitter.setOAuthConsumer("67MIcbC1X6mbpaEqxa7YTd1hDPIdLb5bLKf4TxIRLAsX63DgFQ", "7HHjSHJ6Rjxx4ASC2465AlWBG");
        twitter.setOAuthAccessToken(new AccessToken("s1y1iAhG5nsXTrE9OVAsqMtqiLIP4QKT8CmTRVgV9LC3O", "110445397-Cf3l9NAK4iD8VAERXp0ZMKnAfWx9KywuJs3OSdkF"));

        try {

            ResponseList<Status> a = twitter.getUserTimeline(new Paging(1,5));

            for(Status b: a) {
                System.out.println(b.getText());
            }

        }catch(Exception e ){

        }

    }
}

Below is the error which i get

Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=b64d2231 or
http://www.google.co.jp/search?q=309f0452
TwitterException{exceptionCode=[b64d2231-309f0452], statusCode=403,     message=SSL is required, code=92, retryAfter=-1,    rateLimitStatus=RateLimitStatusJSONImpl{remaining=178, limit=180, resetTimeInSeconds=1430935706, secondsUntilReset=775}, version=3.0.3}

What is the reason for the error?

1
How do you know you don't have any errors? You are silently consuming all exceptions. You should at least call e.printStackTrace() in your catch block to make sure your call to twitter isn't failing.azurefrog
@azurefrog Ya :( this is the error i get Relevant discussions can be found on the Internet at: google.co.jp/search?q=b64d2231 or google.co.jp/search?q=309f0452 TwitterException{exceptionCode=[b64d2231-309f0452], statusCode=403, message=SSL is required, code=92, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=178, limit=180, resetTimeInSeconds=1430935706, secondsUntilReset=775}, version=3.0.3}. Will update my questionAarish Ramesh
@azurefrog Thanks mate!! Can you please take a look into the error?Aarish Ramesh
@azurefrog It states that ssl is required. Is it the cause?Aarish Ramesh
Yes, it is. At least that's what the exception says.Exceen

1 Answers

2
votes

You need to set SSL enabled. Look at this topic for further information: "SSL is required" exception while requesting OAuthRequest Token using Twitter4J library