Announcement Announcement Module
No announcement yet.
java.lang.NoSuchMethodError: StringHttpMessaStringHttpMessageConverter.<ini Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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

    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


    HTTP Status 500 -


    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(
    org.springframework.web.servlet.DispatcherServlet. doService(
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    org.springframework.web.servlet.FrameworkServlet.d oGet(
    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(
    com.zinghopper.web.filter.UrlRedirectionFilter.doF ilter(
    org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(
    org.springframework.web.filter.DelegatingFilterPro xy.doFilter($ VirtualFilterChain.doFilter( 311) FilterSecurityInterceptor.invoke(FilterSecurityInt 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.


    • #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.


      • #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.



        • #5
          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?



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




            • #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
     okServiceProvider.getApi(FacebookServiceProvider.j ava:43)
     okServiceProvider.getApi(FacebookServiceProvider.j ava:27)
              com.planetrestore.service.impl.SocialMediaService. completeOAuth2(

              Any idea why is this happening?


              • #8
                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



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


                  • #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.



                    • #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.


                      • #12
                        Problem solve...thanks!


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



                          [2013-04-29 22:56:06,918] [WARN ] [org.springframework.web.client.RestTemplate:478] - POST request for "" resulted in 400 (Bad Request); invoking error handler
                          [2013-04-29 23:00:18,856] [WARN ] [ ort:151] - HttpClientErrorException while completing connection: 400 Bad Request
                          [2013-04-29 23:00:18,857] [WARN ] [ ort:152] - Response body: {"error":{"message":"This authorization code has expired.","type":"OAuthException","code":100}}
                          [2013-04-29 23:00:18,898] [WARN ] [ 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 iBinding.getFormMessageConverter(AbstractOAuth2Api
                          at iBinding.getMessageConverters(AbstractOAuth2ApiBin
                          at iBinding.<init>(
                          at ookTemplate.<init>(
                          at okServiceProvider.getApi(FacebookServiceProvider.j ava:43)
                          at okServiceProvider.getApi(FacebookServiceProvider.j ava:27)
                          at onnection.initApi(
                          at onnection.<init>(
                          at onnectionFactory.createConnection(OAuth2Connection
                          at ort.completeConnection(
                          at roller.oauth2Callback(
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(Native
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
                          at java.lang.reflect.Method.invoke(
                          at ndlerMethod.invoke( )
                          at ndlerMethod.invokeForRequest(InvocableHandlerMetho
                          at org.springframework.web.servlet.mvc.method.annotat ion.ServletInvocableHandlerMethod.invokeAndHandle(
                          at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.invokeHandlerMeth od(
                          at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.handleInternal(Re
                          at org.springframework.web.servlet.mvc.method.Abstrac tHandlerMethodAdapter.handle(AbstractHandlerMethod
                          at org.springframework.web.servlet.DispatcherServlet. doDispatch(
                          at org.springframework.web.servlet.DispatcherServlet. doService(
                          at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
                          at org.springframework.web.servlet.FrameworkServlet.d oGet(
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:621)
                          at javax.servlet.http.HttpServlet.service(HttpServlet .java:728)
                          at ternalDoFilter(
                          at Filter(
                          at org.springframework.web.filter.CharacterEncodingFi lter.doFilterInternal( :88)
                          at org.springframework.web.filter.OncePerRequestFilte r.doFilter(
                          at ternalDoFilter(
                          at Filter(
                          at org.apache.catalina.core.StandardWrapperValve.invo ke(
                          at org.apache.catalina.core.StandardContextValve.invo ke(
                          at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(
                          at org.apache.catalina.core.StandardHostValve.invoke(
                          at org.apache.catalina.valves.ErrorReportValve.invoke (
                          at org.apache.catalina.valves.AccessLogValve.invoke(A
                          at org.apache.catalina.core.StandardEngineValve.invok e(
                          at org.apache.catalina.connector.CoyoteAdapter.servic e(
                          at org.apache.coyote.http11.AbstractHttp11Processor.p rocess(
                          at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(
                          at java.util.concurrent.ThreadPoolExecutor$ (
                          Last edited by Gurana; Apr 29th, 2013, 02:03 PM.


                          • #14
                            Again, I say that the problem isn't with the versions you explicitly'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.