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>https://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! :)

Published 1 Oct 2011

I build mobile and web applications. Full Stack, Rails, React, Typescript, Kotlin, Swift
Pulkit Goyal on Twitter