我正在尝试将SpringSocial与我正在构建的webapp集成,并且一直遵循here的说明。
我创建了@Configuration类(包括LinkedIn提供的ID /键)并设置配置以注册ConnectController bean,然后在我的网页上添加了一个按钮,使用以下代码连接到linkedIn: / p>
<form action="<c:url value="/connect/linkedin" />" method="POST">
<button type="submit">Connect to LinkedIn</button>
</form>
当我按下按钮时,它成功地将我带到LinkedIn授权页面并将我的应用识别为请求授权,问题是,当我按批准时,我会返回到我的应用程序,但会收到以下错误:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.client.RestTemplate.setInterceptors([Lorg/springframework/http/client/ClientHttpRequestInterceptor;)V
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:949)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:779)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:427)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
...
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
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:65)
at org.springframework.social.linkedin.connect.LinkedInServiceProvider.getApi(LinkedInServiceProvider.java:38)
at org.springframework.social.linkedin.connect.LinkedInServiceProvider.getApi(LinkedInServiceProvider.java:27)
at org.springframework.social.connect.support.OAuth1Connection.initApi(OAuth1Connection.java:94)
at org.springframework.social.connect.support.OAuth1Connection.<init>(OAuth1Connection.java:56)
at org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59)
at org.springframework.social.connect.web.ConnectSupport.completeConnection(ConnectSupport.java:115)
at org.springframework.social.connect.web.ConnectController.oauth1Callback(ConnectController.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:631)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:592)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
... 67 more
任何人都可以告诉我可能做错了吗?
感谢。
答案 0 :(得分:1)
这看起来像jar版本不兼容。尝试使用最新的春季(3.1)和最新的春季社交版本。