Ok, I think I have found the problem. The stack trace states the cause is:
Code:
Caused by: java.lang.NoSuchMethodError: org.springframework.web.client.RestTemplate.setInterceptors([Lorg/springframework/http/client/ClientHttpRequestInterceptor;)V
at org.springframework.social.oauth1.ProtectedResourceClientFactory.create(ProtectedResourceClientFactory.java:51)
at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.<init>(AbstractOAuth1ApiBinding.java:59)
at org.springframework.social.linkedin.api.impl.LinkedInTemplate.<init>(LinkedInTemplate.java:66)
at org.springframework.social.linkedin.connect.LinkedInServiceProvider.getApi(LinkedInServiceProvider.java:38)
So looking at the calling code in bold (ProtectedResourceClientFactory.create()) it is as follows:
Code:
public static RestTemplate create(OAuth1Credentials credentials) {
RestTemplate client = new RestTemplate(ClientHttpRequestFactorySelector.getRequestFactory());
if (interceptorsSupported) {
// favored
client.setInterceptors(new ClientHttpRequestInterceptor[] { new OAuth1RequestInterceptor(credentials)});
}
The problem is that the setInterceptors() method in the RestTemplate in Spring-Web-3.1.1 is expecting a List<ClientHttpRequestInterceptor> not an array (so the problem isnt that it cant find the method, but rather the signature is different).
The ProtectedResourceClientFactory is part of the Spring-Social-Core project, and I am currently using version 1.0.0.RC3 of Spring-Social-Core - is there a more recent version of the project I should be using to align this? This is the latest i can see in this mvn repo: http://maven.springframework.org/milestone/ (is there a better maven repo that I can use for the social stuff?)
Thanks for the help!