Jackson : NoSuchMethodError for org.codehaus.jackson.map.DeserializationConfig.withAnnotationIntrospector

StackOverflow https://stackoverflow.com/questions/17357845

Question

I am using Spring MVC 3.2 with Jackson.Everything works fine when I was working on Ubuntu 12.04. But our deployment server has Cent OS 6.So while deploying My project copy on server following stacktrace is coming and application is failed to get deployed.

java.lang.NoSuchMethodError: org.codehaus.jackson.map.DeserializationConfig.withAnnotationIntrospector(Lorg/codehaus/jackson/map/AnnotationIntrospector;)Lorg/codehaus/jackson/map/DeserializationConfig;
    at com.domain.atmosphere.JaxbJacksonObjectMapper.<init>(JaxbJacksonObjectMapper.java:26)
    at com.controller.BroadCastingController.pollForNewArrival(BroadCastingController.java:132)
    at com.controller.BroadCastingController$$FastClassByCGLIB$$379dc3e.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    at com.hcdc.coedp.safe.controller.BroadCastingController$$EnhancerByCGLIB$$8be92c05.pollForNewArrival(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

Following are the jars that I am using for jackson support.

  jackson-annotations-2.0.4.jar:
  jackson-databind-2.0.4.jar:
  jackson-xc-1.9.11.jar:
  jackson-mapper-asl-1.9.8.jar:
  jackson-core-2.0.4.jar:
  jackson-core-asl-1.9.8.jar

And this is my custom JaxbJacksonObjectMapper

public class JaxbJacksonObjectMapper extends ObjectMapper {


    public JaxbJacksonObjectMapper() {
        final AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
        super.getDeserializationConfig().withAnnotationIntrospector(introspector);
        super.getSerializationConfig().withAnnotationIntrospector(introspector);
        this.enableDefaultTypingAsProperty(DefaultTyping.JAVA_LANG_OBJECT, JsonTypeInfo.Id.CLASS.getDefaultPropertyName());
    }

}

I read in this answer that this is a problem of version incompatibility.So if that's the case If any one could tell me the right version to be used with Spring MVC 3.2 I will be grateful.

Thanks.

Was it helpful?

Solution

You have libraries from different packages and diferent versions.

Package: com.fasterxml.jackson.core

  • Libraries in your project from this package:
    • jackson-annotations-2.0.4.jar:
    • jackson-databind-2.0.4.jar:
    • jackson-core-2.0.4.jar:

Package: org.codehaus.jackson

  • Libraries in your project from this package:
    • jackson-xc-1.9.11.jar:
    • jackson-mapper-asl-1.9.8.jar
    • jackson-core-asl-1.9.8.jar

Jackson changed the name of the package in the version 2 to com.fasterxml.jackson.core, so you should remove all your libraries from previous version 1 in order to avoid incompatibilites problems.

Here in this other link they had problems with version 1 and Spring 3, maybe it could add more information about your problem and possible changes you will have to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top