Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoSuchMethodError: StringHttpMessaStringHttpMessageConverter.<ini Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NoSuchMethodError: StringHttpMessaStringHttpMessageConverter.<ini

    Hi all,
    Suddenly my web application integrated via Spring social is not letting me logon. Below is the stack trace.

    Below are my version
    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.springframework.security-version>3.1.0.RELEASE</org.springframework.security-version>
    <org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
    <org.springframework.social.facebook-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.facebook-version>

    i tried changing the spring version to latest but had some other repercussion.
    i tried creating a new app and still get the same error.

    Any help would be greatly appreciated

    Thanks

    HTTP Status 500 -

    exception

    org.springframework.web.util.NestedServletExceptio n: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.StringHttpMessa geConverter.<init>(Ljava/nio/charset/CharsetV
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:972)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:722)
    org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:393)
    com.zinghopper.web.filter.UrlRedirectionFilter.doF ilter(UrlRedirectionFilter.java:59)
    org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:259)
    org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 311)
    org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:116)
    org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nter

  • #2
    oh. finally figured it out.

    The version of Spring social build with 20130215 was (spring-social-core-1.1.0.BUILD-20130215.091522-300) was the problem. used the previous built jars and it worked.

    Comment


    • #3
      Glad you figured it out! It's funny, I encountered the exact same problem yesterday because I was switching between older branches of Spring Social.

      Comment


      • #4
        Dear Craig Walls (habuma),
        Thanks for your reply. I was just thinking, this solution may not be correct though it worked. Ideally i need to get the latest Spring-web which contains StringHttpMessageConverter which i am going to try next. Please correct me if i am wrong.

        Thanks
        Shreenidhi

        Comment


        • #5
          Hi,
          I'm currently integrating Spring Social and JSF, and I got that error when connecting. I am using spring-social-core-1.1.0.M2 to which version should I switch to avoid this exception?

          Regards,
          jfzr

          Comment


          • #6
            dear jfzr,
            Here are my version details. Its working for me. May be you can also try

            <org.springframework-version>3.1.4.RELEASE</org.springframework-version>
            <org.springframework.security-version>3.1.1.RELEASE</org.springframework.security-version>
            <org.springframework.social-version>1.1.0.M2</org.springframework.social-version>
            <org.springframework.social.facebook-version>1.1.0.M2</org.springframework.social.facebook-version>
            <org.springframework.social.twitter-version>1.0.1.RELEASE</org.springframework.social.twitter-version>

            Regards
            Shreenidhi

            Comment


            • #7
              HI shreenidhisp,
              Thanks for your fast answer. I just try the same repositories as the one you post; but still getting this error:

              root cause

              java.lang.NoSuchMethodError: org.springframework.http.converter.StringHttpMessa geConverter.<init>(Ljava/nio/charset/CharsetV
              org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getFormMessageConverter(AbstractOAuth2Api Binding.java:143)
              org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getMessageConverters(AbstractOAuth2ApiBin ding.java:126)
              org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.<init>(AbstractOAuth2ApiBinding.java:64)
              org.springframework.social.facebook.api.impl.Faceb ookTemplate.<init>(FacebookTemplate.java:127)
              org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:43)
              org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:27)
              org.springframework.social.connect.support.OAuth2C onnection.initApi(OAuth2Connection.java:132)
              org.springframework.social.connect.support.OAuth2C onnection.<init>(OAuth2Connection.java:71)
              org.springframework.social.connect.support.OAuth2C onnectionFactory.createConnection(OAuth2Connection Factory.java:73)
              com.planetrestore.service.impl.SocialMediaService. completeOAuth2(SocialMediaService.java:193)

              Any idea why is this happening?

              Comment


              • #8
                hi,
                i can only think of one possible reason. Your local repository might have different versioned jars which might have downloaded when you had mentioned earlier version than above. Just try deleting them (all spring related jars) so that build would download fresh jars and try again. Good luck

                Thanks
                Shreenidhi

                Comment


                • #9
                  hi,
                  Thanks once more, quick question which version of jar you have for spring-web. I running 3.2.1.release. Same there?

                  Comment


                  • #10
                    I tried updating to 3.2.1 and i got some other error. I had to spend time and update corresponding dependencies. I had little time. Currently i am using 3.1.4.RELEASE.

                    Thanks
                    Shreenidhi

                    Comment


                    • #11
                      Breaking this away from Spring Social itself (because it's not technically a problem with Spring Social...that's just where you see it manifested), the question is this: Does StringHttpMessageConverter have a constructor that accepts a Charset as a parameter? Because that's what it's complaining about...that the constructor doesn't exist.

                      The answer is yes. It wasn't there in Spring 3.0.x, but it is there by the time Spring 3.1.4 came along and is still there in Spring 3.2.x. Therefore if you say that you have Spring 3.1.4 in your classpath, then that constructor should be there.

                      Nevertheless, there is one way that you could have Spring 3.1.4 in your classpath and still get that exception: If some older version of Spring is also in your classpath. Specifically, if there's an older version of the spring-web module, then this could be a problem. In that case, there are two versions of that library in the classpath and what's happening is that the classloader is loading StringHttpMessageConverter from the older JAR file and not the newer one.

                      Since you're using Maven to do your build, you can check this by viewing the dependency tree. Simply do "mvn dependency:tree" from the command line and review the tree, looking for older versions of Spring. What's probably happening is that one of your other dependencies has a dependency on an older version of Spring and is pulling that in transitively.

                      Also, the fact that you're using version 1.0.1.RELEASE of Spring Social Twitter is probably going to cause you trouble when you use it alongside 1.1.0.M2 of Spring Social. You might want to check that.

                      Comment


                      • #12
                        Problem solve...thanks!

                        Comment


                        • #13
                          I am using the below version but same issue

                          <org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
                          <org.springframework.social.facebook-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.facebook-version>
                          <org.springframework.social.twitter-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.twitter-version>


                          Error:

                          [2013-04-29 22:56:06,918] [WARN ] [org.springframework.web.client.RestTemplate:478] - POST request for "https://graph.facebook.com/oauth/access_token" resulted in 400 (Bad Request); invoking error handler
                          [2013-04-29 23:00:18,856] [WARN ] [org.springframework.social.connect.web.ConnectSupp ort:151] - HttpClientErrorException while completing connection: 400 Bad Request
                          [2013-04-29 23:00:18,857] [WARN ] [org.springframework.social.connect.web.ConnectSupp ort:152] - Response body: {"error":{"message":"This authorization code has expired.","type":"OAuthException","code":100}}
                          [2013-04-29 23:00:18,898] [WARN ] [org.springframework.social.connect.web.ConnectCont roller:240] - Exception while handling OAuth2 callback (400 Bad Request). Redirecting to facebook connection status page.


                          SEVERE: Servlet.service() for servlet [ecs] in context with path [/ECS] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.StringHttpMessa geConverter.<init>(Ljava/nio/charset/CharsetV] with root cause
                          java.lang.NoSuchMethodError: org.springframework.http.converter.StringHttpMessa geConverter.<init>(Ljava/nio/charset/CharsetV
                          at org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getFormMessageConverter(AbstractOAuth2Api Binding.java:143)
                          at org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getMessageConverters(AbstractOAuth2ApiBin ding.java:126)
                          at org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.<init>(AbstractOAuth2ApiBinding.java:64)
                          at org.springframework.social.facebook.api.impl.Faceb ookTemplate.<init>(FacebookTemplate.java:127)
                          at org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:43)
                          at org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:27)
                          at org.springframework.social.connect.support.OAuth2C onnection.initApi(OAuth2Connection.java:132)
                          at org.springframework.social.connect.support.OAuth2C onnection.<init>(OAuth2Connection.java:71)
                          at org.springframework.social.connect.support.OAuth2C onnectionFactory.createConnection(OAuth2Connection Factory.java:73)
                          at org.springframework.social.connect.web.ConnectSupp ort.completeConnection(ConnectSupport.java:149)
                          at org.springframework.social.connect.web.ConnectCont roller.oauth2Callback(ConnectController.java:236)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
                          at java.lang.reflect.Method.invoke(Method.java:601)
                          at org.springframework.web.method.support.InvocableHa ndlerMethod.invoke(InvocableHandlerMethod.java:212 )
                          at org.springframework.web.method.support.InvocableHa ndlerMethod.invokeForRequest(InvocableHandlerMetho d.java:126)
                          at org.springframework.web.servlet.mvc.method.annotat ion.ServletInvocableHandlerMethod.invokeAndHandle( ServletInvocableHandlerMethod.java:96)
                          at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.invokeHandlerMeth od(RequestMappingHandlerAdapter.java:617)
                          at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.handleInternal(Re questMappingHandlerAdapter.java:578)
                          at org.springframework.web.servlet.mvc.method.Abstrac tHandlerMethodAdapter.handle(AbstractHandlerMethod Adapter.java:80)
                          at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:900)
                          at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:827)
                          at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:882)
                          at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:778)
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:621)
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:728)
                          at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:305)
                          at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
                          at org.springframework.web.filter.CharacterEncodingFi lter.doFilterInternal(CharacterEncodingFilter.java :88)
                          at org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
                          at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:243)
                          at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
                          at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:222)
                          at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:123)
                          at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
                          at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:171)
                          at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:99)
                          at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:947)
                          at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:118)
                          at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:408)
                          at org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:1009)
                          at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:589)
                          at org.apache.tomcat.util.net.AprEndpoint$SocketProce ssor.run(AprEndpoint.java:1852)
                          at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
                          at java.lang.Thread.run(Thread.java:722)
                          Last edited by Gurana; Apr 29th, 2013, 02:03 PM.

                          Comment


                          • #14
                            Again, I say that the problem isn't with the versions you explicitly declare...it's with the version that are pulled in transitively. Spring Social needs the version of StringHttpMessageConverter that takes a Charset as a parameter, but it's finding an older version (likely, pulled in transitively from some other dependency). At the command line do "mvn dependency:tree" and look to see what versions of spring-web get resolved.

                            If you're still stuck, post the results of "mvn dependency:tree" here and I'll help find the problem.

                            Comment

                            Working...
                            X