0

I'm using SignPost with Java to do a 3-legged OAuth integration. Most of the examples I see use Servlet sessions to preserve the OAuthConsumer across multiple requests, but that's not feasible for us because we use Hazelcast to manage a multi-clustered environment.

"No problem, I'll just use Hazelcast to stash the OAuthConsumer across requests." But when I try to do this I get an Exception:

Caused by: java.io.NotSerializableException: oauth.signpost.http.RequestParameters

Like I said, this is a 3rd Party library so I can't modify it but I do see that OAuthConsumer extends Serializable... so I'm not sure what the problem is.

Has anyone else encountered this problem and been able to work around it?

IcedDante
  • 6,145
  • 12
  • 57
  • 100

1 Answers1

0

After poking around the API we realized we could reconstruct the object if we just used Hazelcast to persist the temporary token and secret.

The calls are:

OAuthConsumer oauthConsumer = new DefaultOAuthConsumer(myAppConsumerKey, myAppConsumerSecret);
oauthConsumer.setTokenWithSecret(temporaryToken, tokenSecret);
IcedDante
  • 6,145
  • 12
  • 57
  • 100
  • Well this is not about Hazelcast but about the class not being serializable, therefore it can't be stored into Hazelcast since we are serializing data. You might want to add a StreamSerializer to implement a serialization strategy. – noctarius Jun 17 '15 at 23:29