Using Twitter4j with SSL connection

This morning my Twitter Data Collection project suddenly stopped working. Suddenly, it failed to connect to the Twitter servers. It is as a result of the recent announcement made by twitter that it would allow only SSL connections starting from 29.09.2011.

I had been using twitter4j to connect to twitter stream. Even after setting the twitter4j.http.useSSL property to true, it failed to connect.The apparent solution to this was to update the twitter4j API to version 2.2.5-SNAPSHOT as announced through this tweet by twitter4j. But even after updating my project’s pom.xml to the new version, the problem wasn’t resolved. I figured out that the SNAPSHOT version wasn’t getting downloaded for twitter4j-core. Here’s how I fixed the problem:

 <repository>
      <id>twitter4j.org</id>
      <name>twitter4j.org Repository</name>
      <url>http://twitter4j.org/maven2</url>
      <releases>
         <enabled>false</enabled>
      </releases>
      <snapshots>
         <enabled>true</enabled>
      </snapshots>
   </repository>

This fixed the problem. Finally my data collection is back on track! 🙂

Advertisements

One response to “Using Twitter4j with SSL connection

  1. Andres Gonzalez January 21, 2014 at 4:39 AM

    Hi Pulkit Goyal, im using twitter4j, but i have the same issue, snice twitter make ssl the only way to conect whit its servers i cant conect whit them… could you help me?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s