Announcement Announcement Module
Collapse
No announcement yet.
any way to make m3 work with spring 3.0.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • any way to make m3 work with spring 3.0.5

    hi,
    we been using m2 for a bit now and i figured i play around and see if i can make m3 work with our code. We are mainly using TwitterServiceProvider and FacebookServiceProvider. in new m3 there are connection factories and i've setup everything fine but it seems that someone left a big issue in regards to 3.1 classes needed in order to work i'm talking about when the rssTemplate makes a call to get a request from the factory it returns this.

    I even tried to access the package leve Sprin300Oauth for backwards use but in the end they all make the same call back to get this class which extens a 3.1 only class. Was this something that slipped by or 3.1 is a must to use m3?

    Caused by: java.lang.NoClassDefFoundError: org/springframework/http/client/AbstractBufferingClientHttpRequest
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :616)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findC lassInternal(WebappClassLoader.java:2331)
    at org.apache.catalina.loader.WebappClassLoader.findC lass(WebappClassLoader.java:976)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1451)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1329)
    at org.springframework.social.support.HttpComponentsC lientHttpRequestFactory.createRequest(HttpComponen tsClientHttpRequestFactory.java:142)
    at org.springframework.social.oauth2.Spring30OAuth2Re questFactory.createRequest(Spring30OAuth2RequestFa ctory.java:50)

    any help or ways around this would be great.. i have everything set just missing this because AbstractBufferingClientHttpRequest is not in spring 3.0.5

    i tried my own classes extended.. i tried stuff already in social m3 but eventually they all make a call to this guy HttpComponentsClientHttpRequest
    which extends that abstract class that is not 3.0. What's the point of having these Spring300 package level classes to use if eventually they still end up making calles to the 3.1 only specific class. Seems like a big overlook.. unless i'm totally wrong and there is a simple way to define a client http request class that does not touch 3.1

    Like i said i even tried to go to to the ProtectedResourceFactory method to get one that does not use

    like so

    private static RestTemplate version(String accessToken, OAuth2Version version) {
    RestTemplate client = new RestTemplate(ClientHttpRequestFactorySelector.getR equestFactory());
    if (interceptorsSupported) {
    // favored
    client.setInterceptors(new ClientHttpRequestInterceptor[] { new OAuth2RequestInterceptor(accessToken, version) });
    } else {
    // 3.0.x compatibility
    client.setRequestFactory(new Spring30OAuth2RequestFactory(client.getRequestFact ory(), accessToken, version));
    }
    return client;
    }


    but this guy again seesm to to hit the 3.1 class because the first line in the method still will end up calling the class that extends
    AbstractBufferingClientHttpRequest (3.1 only class)
    RestTemplate client = new RestTemplate(ClientHttpRequestFactorySelector.getR equestFactory());

    so what gives? can someone help me out... i have all setup except how to avoid using this class and getting the no class found exception.

  • #2
    It appears that this happens when you also have Apache HttpComponents HttpClient in the classpath. ClientHttpRequestFactorySelector tries to use HttpComponentsClientHttpRequestFactory if it's available...otherwise will fallback to SimpleClientHttpRequestFactory.

    The problem is that HttpComponentsClientHttpRequestFactory produces HttpComponentsClientHttpRequest which extends AbstractBufferingClientHttpRequest (and as you pointed out, is a Spring 3.1 class).

    I'm going to try to fix this up so that it will work with both Spring 3.0 and HttpClient. I'll let you know when that happens so that you can try it out.

    In the meantime, one workaround is to remove HttpClient from the classpath. Doing so will cause ClientHttpRequestFactorySelector to choose SimpleClientHttpRequestFactory which should work fine in almost all cases.

    Comment


    • #3
      Okay, I've applied a change that should make this work with Spring 3.0 and HttpClient. And I've just performed a snapshot build that includes that change.

      Try the 1.0.0.BUILD-SNAPSHOT version of Spring Social and let me know if this corrects the problem for you.

      Comment


      • #4
        thank you. Yes the latest build works fine with your changes. Hope this will make it to m4 and you guys don't remove support for 3.0 anytime soon since 3.1 is not yet released and we are using 3.0.5 in production and we would like to continue using spring social until a stable 3.1 public release.

        Comment


        • #5
          Yes, its in master so it will be in the next release and remain through 1.0.x. This was simply an oversight when the HttpComponents support based on an original SPR 3.1 contribution was added to Spring Social to support 3.0.x compatibility. Craig is working on a 3.0.x compatibility test we can run before future releases.

          Keith

          Comment

          Working...
          X