Error with the code that uses Twitter4J API


Hi, I’m working on a code that came with Twitter4J API which gets the Screen Name and Status of the any user on Twitter. I modified it to accept Screen Name as input. When i executed the following errors showed up on the output console.
connect timed outRelevant discussions can be on the Internet at: or
TwitterException{exceptionCode=[bb0a5eb5-1e17b594 5147af80-a4def8b3], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5}
at twitter4j.internal.http.HttpClientImpl.request(
at twitter4j.internal.http.HttpClientWrapper.request(
at twitter4j.internal.http.HttpClientWrapper.get(
at twitter4j.TwitterImpl.get(
at twitter4j.TwitterImpl.showUser(
at ShowUser.main(
Caused by: connect timed out
at Method)
at twitter4j.internal.http.HttpResponseImpl.(
at twitter4j.internal.http.HttpClientImpl.request(
… 5 more
Failed to delete status: connect timed out

Is there anyone who can help me on this issue??? I’m new to this API and app development :slight_smile:


I’m not particularly familiar with Twitter4J’s way of expressing errors, but the status code it is indicating, “-1” suggests to me that your connection isn’t reaching at all, rather than it timing out on Twitter’s side.

I would verify that your machine is capable of connecting to Twitter through SSL by using curl on the command line to fetch a simple endpoint like:

curl -I ""

If that works, then at least SSL and your network connectivity seem to be configured correctly and you can move on to Java environment-specific details.


I am getting this error once I revoked permission from application.

07-08 12:19:47.980: W/System.err(4261): No authentication challenges found
07-08 12:19:47.980: W/System.err(4261): Relevant discussions can be found on the Internet at:
07-08 12:19:48.000: W/System.err(4261): or
07-08 12:19:48.000: W/System.err(4261):
07-08 12:19:48.015: W/System.err(4261): TwitterException{exceptionCode=[b2b52c28-10981ac7 4ef6906d-026b39df], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
07-08 12:19:48.070: W/System.err(4261): at twitter4j.internal.http.HttpClientImpl.request(
07-08 12:19:48.144: W/System.err(4261): at twitter4j.internal.http.HttpClientWrapper.request(
07-08 12:19:48.181: W/System.err(4261): at
07-08 12:19:48.200: W/System.err(4261): at
07-08 12:19:48.210: W/System.err(4261): at twitter4j.TwitterImpl.updateStatus(
07-08 12:19:48.221: W/System.err(4261): at com.objectlounge.ridesharebuddy.socialmedia.RS_Twitter.tweet(
07-08 12:19:48.244: W/System.err(4261): at com.objectlounge.ridesharebuddy.activities.RS_CreateTripActivity$PostOnSocialMedia.doInBackground(
07-08 12:19:48.251: W/System.err(4261): at com.objectlounge.ridesharebuddy.activities.RS_CreateTripActivity$PostOnSocialMedia.doInBackground(
07-08 12:19:48.261: W/System.err(4261): at android.os.AsyncTask$
07-08 12:19:48.271: W/System.err(4261): at
07-08 12:19:48.302: W/System.err(4261): at android.os.AsyncTask$SerialExecutor$
07-08 12:19:48.310: W/System.err(4261): at java.util.concurrent.ThreadPoolExecutor.runWorker(
07-08 12:19:48.321: W/System.err(4261): at java.util.concurrent.ThreadPoolExecutor$
07-08 12:19:48.330: W/System.err(4261): at
07-08 12:19:48.351: W/System.err(4261): Caused by: No authentication challenges found
07-08 12:19:48.372: W/System.err(4261): at
07-08 12:19:48.380: W/System.err(4261): at
07-08 12:19:48.403: W/System.err(4261): at
07-08 12:19:48.422: W/System.err(4261): at
07-08 12:19:48.432: W/System.err(4261): at
07-08 12:19:48.450: W/System.err(4261): at twitter4j.internal.http.HttpResponseImpl.(
07-08 12:19:48.490: W/System.err(4261): at twitter4j.internal.http.HttpClientImpl.request(


Doing “curl -I “””, I got this response.

HTTP/1.1 410 Gone
content-length: 160
content-type: application/json; charset=utf-8
date: Mon, 08 Jul 2013 07:09:43 UTC
server: tfe
set-cookie: guest_id=v1%3A137326738342994938;; Path=/; Expires=Wed, 08-Jul-2015 07:09:43 UTC
strict-transport-security: max-age=631138519

What does this mean?


[dbadmin@smt-hadoop apache-flume-1.3.1-bin]$ curl -I ""
curl: (7) couldn’t connect to host

Any idea, how to resolve this


I also have the same problem using twitter 4j.
01-22 15:44:52.212: W/System.err(27444): oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.

so how do I resolve this issue?

Any suggestion welcome…


i have the same problem can any one help me try from a week but still coludnt find the solution