spring-social-linkedin与spring-social 1.1的兼容性

时间:2014-10-10 08:41:14

标签: spring-social-linkedin

我们有一个项目使用spring-social-facebook,spring-social-twitter,spring-social-linkedin和spring-social-google。我们目前使用以下版本:

  • spring-social-core:1.0.3
  • spring-social-facebook:1.0.1
  • spring-social-twitter:1.0.5
  • spring-social-google:1.0.0
  • spring-social-linkedin:1.0.0.RC1

我们正在尝试将Facebook和Twitter更新为1.1目前还没有适用于LinkedIn和Google+的1.1库,因此最终版本为:

  • spring-social-core:1.1.0.RELEASE
  • spring-social-facebook:1.1.1.RELEASE
  • spring-social-twitter:1.1.0.RELEASE
  • spring-social-google:1.0.0
  • spring-social-linkedin:1.0.0.RC1

自从进行此更改后,LinkedIn登录不再有效,抛出以下异常:

  

org.springframework.http.converter.HttpMessageNotReadableException&#39 ;.   org.springframework.http.converter.HttpMessageNotReadableException:无法读取JSON:没有为类型[simple type,class org.springframework.social.linkedin.api.LinkedInProfile]找到合适的构造函数:无法从JSON对象实例化(需要添加/启用类型信息?)    在[来源:org.apache.http.conn.EofSensorInputStream@7659b0e8; line:2,column:3];嵌套异常是com.fasterxml.jackson.databind.JsonMappingException:找不到类型[simple type,class org.springframework.social.linkedin.api.LinkedInProfile]的合适构造函数:无法从JSON对象实例化(需要添加/启用类型)信息?)    在[来源:org.apache.http.conn.EofSensorInputStream@7659b0e8; line:2,column:3]       在org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:170)~ [spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.read(MappingJackson2HttpMessageConverter.java:162)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:94)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:492)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.client.RestTemplate.execute(RestTemplate.java:447)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:215)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.social.linkedin.api.impl.ProfileTemplate.getUserProfile(ProfileTemplate.java:79)〜[spring-social-linkedin-1.0.0.RC1.jar:na]       在com.globaldawn.social.core.oauth.handler.LinkedInOAuthHandler.authenticate(LinkedInOAuthHandler.java:94)〜[social-core-4.0.4219.jar:na]       在com.globaldawn.social.core.oauth.service.SocialOAuthService.authenticateWithSocialNetwork(SocialOAuthService.java:371)〜[social-core-4.0.4219.jar:na]       在com.globaldawn.social.core.oauth.service.SocialOAuthService.authenticate(SocialOAuthService.java:160)〜[social-core-4.0.4219.jar:na]       在com.globaldawn.social.web.controller.login.SocialLoginControllerUtil.login(SocialLoginControllerUtil.java:194)〜[classes /:na]       在com.globaldawn.social.web.controller.login.SocialLoginControllerUtil.successfulLoginCallback(SocialLoginControllerUtil.java:117)〜[classes /:na]       在com.globaldawn.social.web.controller.login.LinkedInSocialLoginController.successfulOAuthLoginCallback(LinkedInSocialLoginController.java:126)〜[classes /:na]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.7.0_51]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)〜[na:1.7.0_51]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.7.0_51]       在java.lang.reflect.Method.invoke(Method.java:606)〜[na:1.7.0_51]       在org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)〜[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:746)~ [spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)~ [spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)〜[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在javax.servlet.http.HttpServlet.service(HttpServlet.java:735)[social-rest-service.war:na]       在org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在javax.servlet.http.HttpServlet.service(HttpServlet.java:848)[social-rest-service.war:na]       在org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)[social-rest-service.war:na]       在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1506)[social-rest-service.war:na]       at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1494)[social-rest-service.war:na]       在org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1486)[social-rest-service.war:na]       在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138)[social-rest-service.war:na]       在org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:564)[social-rest-service.war:na]       在org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)[social-rest-service.war:na]       在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)[social-rest-service.war:na]       在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[social-rest-service.war:na]       在com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:173)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[social-rest-service.war:na]       at com.globaldawn.application.monitoring.RequestMetricsHandler.handle(RequestMetricsHandler.java:98)[social-rest-service.war:na]       在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[social-rest-service.war:na]       在org.eclipse.jetty.server.Server.handle(Server.java:445)[social-rest-service.war:na]       在org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)[social-rest-service.war:na]       在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)[social-rest-service.war:na]       在org.eclipse.jetty.io.AbstractConnection $ ReadCallback.run(AbstractConnection.java:358)[social-rest-service.war:na]       在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)[social-rest-service.war:na]       在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:532)[social-rest-service.war:na]       在java.lang.Thread.run(Thread.java:744)[na:1.7.0_51]   引起:com.fasterxml.jackson.databind.JsonMappingException:找不到类型[simple type,class org.springframework.social.linkedin.api.LinkedInProfile]的合适构造函数:无法从JSON对象实例化(需要添加/启用类型)信息?)    在[来源:org.apache.http.conn.EofSensorInputStream@7659b0e8; line:2,column:3]       在com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)〜[jackson-databind-2.3.2.jar:2.3.2]       at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1078)~ [jackson-databind-2.3.2.jar:2.3.2]       在com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:268)〜[jackson-databind-2.3.2.jar:2.3.2]       在com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:124)〜[jackson-databind-2.3.2.jar:2.3.2]       at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2993)~ [jackson-databind-2.3.2.jar:2.3.2]       at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2158)~ [jackson-databind-2.3.2.jar:2.3.2]       在org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:167)〜[spring-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]       ...省略了58个常见帧

我们使用gradle作为依赖关系管理,它始终采用需要不同版本的软件包的最高版本号,因此spring-social-linkedin对spring-social-core 1.0.3的依赖性是强制性的&#39 ;升级'到1.1.0。这兼容吗?是否可以在使用spring-social-facebook 1.1版和/或spring-social-twitter的项目中使用spring-social-linkedin?

1 个答案:

答案 0 :(得分:1)

答案似乎是spring-social-core v1.1与spring-social-linkedin v1.0不兼容 - v1.0使用org.codehaus.jackson来序列化JSON,而v1.1使用com。 fasterxml.jackson.core。

如果您需要在同一模块中使用spring-social-linkedin,则无法将spring-social-facebook或spring-social-twitter升级到v1.1。

并不完全令人惊讶,但我们可能需要完全摆脱春天社交,因为我们需要更新的功能,不能解开不同的社交网络。