Announcement Announcement Module
Collapse
No announcement yet.
Integration with Facebook - java.lang.NoSuchMethodError: org.codehaus.jackson.map.Obj Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integration with Facebook - java.lang.NoSuchMethodError: org.codehaus.jackson.map.Obj

    Hi

    I have downloaded Spring Facebook integration demo using
    https://github.com/santoshrangarajan/SpringFbDemo

    However when I try to implement, faced lot of issues.
    a) Does any one have a working example with appropriate libraries.
    b) If not, I am having issue with the code I have downloaded. when I run the app, I am getting the following problem


    SEVERE: Servlet.service() for servlet appServlet threw exception
    java.lang.NoSuchMethodError: org.codehaus.jackson.map.ObjectMapper.registerModu le(Lorg/codehaus/jackson/map/ModuleV
    at org.springframework.social.facebook.api.impl.Faceb ookTemplate.getJsonMessageConverter(FacebookTempla te.java:236)
    at org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getMessageConverters(AbstractOAuth2ApiBin ding.java:128)
    at org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.<init>(AbstractOAuth2ApiBinding.java:61)
    at org.springframework.social.facebook.api.impl.Faceb ookTemplate.<init>(FacebookTemplate.java:107)
    at org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:33)
    at org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:26)
    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:58)
    at org.springframework.social.connect.web.ConnectSupp ort.completeConnection(ConnectSupport.java:125)
    at org.springframework.social.connect.web.ProviderSig nInController.oauth2Callback(ProviderSignInControl ler.java:161)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.web.method.support.InvocableHa ndlerMethod.invoke(InvocableHandlerMethod.java:213 )
    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:923)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:852)
    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:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)


    Did anyone encounter this issue? I tried with various versions of Jackson jars but no luck.. Please suggest what options I have..

    Thanks

  • #2
    I know nothing about that particular example...perhaps the author of that example is listening and could chime in.

    But, I'd recommend Jackson version 1.9.9. The Spring Social samples at (https://github.com/SpringSource/spring-social-samples) use that version with no issues. I should probably upgrade to depend on Jackson 2, but that's still on the TODO list.

    Comment


    • #3
      Hi,

      Even am also getting the same error. I tried with jackson 1.9.9 also as as you said above but still am seeing the same error.
      Can you suggest me how to resolve this issue. I tried with all other versions of jackson jars also.

      I have one more question,how to get the access code from the url which is redirected from FB to our controller through OAuth2 params and how Connect Controller will work. Do i need code some for this.

      I downloaded the app from http://www.captaindebug.com/2012/07/...l#.UW4q57XLppU


      Thanks
      Sree
      Last edited by [email protected]; Apr 17th, 2013, 12:00 AM.

      Comment


      • #4
        Hi,

        This is the problem am facing...When i run the app
        org.springframework.web.util.NestedServletExceptio n: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.codehaus.jackson.map.ObjectMapper.registerModu le(Lorg/codehaus/jackson/map/ModuleV
        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:690)
        javax.servlet.http.HttpServlet.service(HttpServlet .java:803)

        root cause

        java.lang.NoSuchMethodError: org.codehaus.jackson.map.ObjectMapper.registerModu le(Lorg/codehaus/jackson/map/ModuleV
        org.springframework.social.facebook.api.impl.Faceb ookTemplate.getJsonMessageConverter(FacebookTempla te.java:236)
        org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.getMessageConverters(AbstractOAuth2ApiBin ding.java:128)
        org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.<init>(AbstractOAuth2ApiBinding.java:61)
        org.springframework.social.facebook.api.impl.Faceb ookTemplate.<init>(FacebookTemplate.java:107)
        org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:33)
        org.springframework.social.facebook.connect.Facebo okServiceProvider.getApi(FacebookServiceProvider.j ava:26)
        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:58)
        com.techgene.poc.springsocial.FacebookPostsControl ler.getUserInfo(FacebookPostsController.java:93)
        com.techgene.poc.springsocial.FacebookPostsControl ler.showUser(FacebookPostsController.java:63)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        org.springframework.web.method.support.InvocableHa ndlerMethod.invoke(InvocableHandlerMethod.java:213 )
        org.springframework.web.method.support.InvocableHa ndlerMethod.invokeForRequest(InvocableHandlerMetho d.java:126)
        org.springframework.web.servlet.mvc.method.annotat ion.ServletInvocableHandlerMethod.invokeAndHandle( ServletInvocableHandlerMethod.java:96)
        org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.invokeHandlerMeth od(RequestMappingHandlerAdapter.java:617)
        org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.handleInternal(Re questMappingHandlerAdapter.java:578)
        org.springframework.web.servlet.mvc.method.Abstrac tHandlerMethodAdapter.handle(AbstractHandlerMethod Adapter.java:80)
        org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:923)
        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:690)
        javax.servlet.http.HttpServlet.service(HttpServlet .java:803)


        Thanks
        Sree

        Comment


        • #5
          Well, if you go look at the code for Jackson 1.9.9 or if you do code completion on the ObjectMapper type, you'll see that the method being complained about *does* exist. Moreover, the Spring Social samples (showcase, et al) all use it with no problem.

          Therefore, my instinct tells me that there's something awry with your project's classpath. Either you have an older version of Jackson in the classpath, you have more than one Jackson in your classpath, or there's something else missing. And, narrowing it down further, I suspect that it's a case where you have more than one Jackson in your classpath.

          I've seen this kind of thing before (not with Jackson, necessarily, but with Java libraries in general). Here's how it plays out:

          Let's say you have Jackson 1.9.9 in your classpath, but you *also* have an older version of Jackson in the classpath. Both have ObjectMapper.registerModule(Module) and both have Module. But for whatever reason, Module is being resolved from one version while ObjectMapper is being resolved from another. Those two are incompatible and you get the exception you see.

          Again, this is all just speculation based on what I see here. I can't know for certain because I don't see your code, nor can I do a dependency analysis on it to find evidence to support or deny my theory. If you're building with Maven, use the dependency:tree goal to see what dependencies are resolved. If you build it into a WAR file, crack the WAR file open and see what's in WEB-INF/lib. If there are two Jacksons, then that's your problem.

          If that's not your problem, then I'm at a loss. Unless you can put your code somewhere in GitHub or elsewhere for me to look at, I am not sure what further help I can offer.

          Comment


          • #6
            hi, Thanks for the update. Am sure that in build path i have only jackson 1.9.9 jar. Please find the attachment of my code.

            Even am getting the same error in Twitter integration also.


            Thanks

            Comment


            • #7
              Again, this is very much a dependency issue, specifically with Jackson. I thank you for sharing your code with me, but you've only shared Java code and some Eclipse metadata. There's no Maven pom.xml, Gradle build.gradle, or even an Eclipse .classpath file for me to examine for dependency details.

              How are you building this? If you're using the IDE's build facilities, then share your .classpath file. That said, I do *NOT* recommend that build approach and do recommend Maven or Gradle. If you're using one of those, then can I see your pom.xml or build.gradle file?

              Once more, this is likely not an issue with Spring Social. The samples projects work fine and don't have this kind of Jackson dependency issue. The issue is very likely a dependency issue and to be able to help you, I'll need to better understand how you're resolving dependencies in your project.

              Comment

              Working...
              X