gpt4 book ai didi

java - SpringSocial LinkedIn 集成错误

转载 作者:行者123 更新时间:2023-12-01 15:30:11 25 4
gpt4 key购买 nike

我正在尝试将 SpringSocial 与我正在构建的 Web 应用程序集成,并且一直遵循说明 here .

我已经创建了我的 @Configuration 类(包括 LinkedIn 提供的 ID/ key )并设置了注册 ConnectController bean 的配置,然后我在网页上添加了一个按钮以使用以下代码连接到 linkedIn:

<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

谁能告诉我我可能做错了什么?

谢谢。

最佳答案

这看起来像是 jar 版本不兼容。尝试使用最新的 spring (3.1) 和最新的 spring-social 版本。

关于java - SpringSocial LinkedIn 集成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9625986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com