0

I am struggling with a NoClassDefFound exception in access to spring-social linked in and facebook. What is strange is I have a project which works using the same code for connexion and one which does nt. I have gone thru the differences between the 2 of them and doesnt see any which makes sense to me.

Here is the full trace I get. Any hint or search direction is welcome.

    type Exception report
    message Handler processing failed; nested exception is java.lang.NoClassDefFoundError:     org/apache/http/client/protocol/HttpClientContext

    description The server encountered an internal error that prevented it from fulfilling this request.exception

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/protocol/HttpClientContext
    org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

java.lang.NoClassDefFoundError: org/apache/http/client/protocol/HttpClientContext
    org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.createHttpContext(ClientHttpRequestFactorySelector.java:80)
    org.springframework.http.client.HttpComponentsClientHttpRequestFactory.createRequest(HttpComponentsClientHttpRequestFactory.java:134)
    org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:76)
    org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)
    org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
    org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:302)
    org.springframework.social.oauth2.OAuth2Template.postForAccessGrant(OAuth2Template.java:232)
    org.springframework.social.oauth2.OAuth2Template.exchangeForAccess(OAuth2Template.java:142)
    org.springframework.social.connect.web.ConnectSupport.completeConnection(ConnectSupport.java:151)
    org.springframework.social.connect.web.ConnectController.oauth2Callback(ConnectController.java:250)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.37 logs.
4

2 回答 2

2

org/apache/http/client/protocol/HttpClientContext 是自 4.3 以来封装在 httpcomponents-client 中的一个类(https://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http /client/protocol/HttpClientContext.html)。我认为您根本没有正确的版本或项目。

尝试添加这个:

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.3.2</version>
</dependency>
于 2014-02-11T10:03:28.897 回答
1

更改为 HTTP Client 4.3.1,它应该可以工作......也看看

https://issues.springsource.org/browse/SOCIALFB-144?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

于 2014-02-11T10:00:17.770 回答