Failure initializing default SSL context

I was trying to use this apache HttpClient to have my web application publish posts to facebook wall.

At first sight, it looks good when I test it in my local machine. I can publish posts to user wall and I’m happy.

But when I deploy it to shared server. Things don’t go as expected. My application can not post to user’s wall and spit this error instead.

org.apache.http.conn.ssl.SSLInitializationException: Failure initializing default SSL context
   at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocketFactory.java:360)
   at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:175)
   at org.apache.http.impl.conn.SchemeRegistryFactory.createDefault(SchemeRegistryFactory.java:49)
   at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(AbstractHttpClient.java:306)
   at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:466)
   at org.apache.http.impl.client.AbstractHttpClient.createHttpContext(AbstractHttpClient.java:286)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:851)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
Caused by: java.lang.IllegalStateException
   at gnu.javax.net.ssl.provider.X509KeyManagerFactory.engineGetKeyManagers(libgcj.so.10)
   at javax.net.ssl.KeyManagerFactory.getKeyManagers(libgcj.so.10)
   at org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:226)
   at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocketFactory.java:358)
   ...32 more

I thought it might be something related to the server since the code works properly on my local machine.

I tried googling but that didn’t help much.

About two weeks later, I came back to the issue and decided to switch to use basic connection using code from http://stackoverflow.com/questions/10913657/posting-to-a-users-wall-using-the-post-request-and-graph-api

and, viola, it works fine now, happy ending🙂

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