我将 Spring MVC 3.2 与 Jackson 一起使用。当我在 Ubuntu 12.04 上工作时,一切正常。但是我们的部署服务器具有 Cent OS 6。因此,在堆栈跟踪即将到来的服务器上部署我的项目副本时,应用程序无法部署。
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)
以下是我用于杰克逊支持的罐子。
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
这是我的习惯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());
}
}
我在这个答案中读到这是版本不兼容的问题。所以如果是这样的话,如果有人能告诉我与 Spring MVC 3.2 一起使用的正确版本,我将不胜感激。
谢谢。