我正在使用Jackson示例代码对POJO进行反序列化:
ObjectMapper m = new ObjectMapper();
这行抛出一个NoSuchMethodError:
Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.<init>(Ljava/lang/Class;)V at org.codehaus.jackson.map.type.TypeBase.<init>(TypeBase.java:15) at org.codehaus.jackson.map.type.SimpleType.<init>(SimpleType.java:45) at org.codehaus.jackson.map.type.SimpleType.<init>(SimpleType.java:40) at org.codehaus.jackson.map.type.TypeBindings.<clinit>(TypeBindings.java:18) at org.codehaus.jackson.map.type.TypeFactory._fromType(TypeFactory.java:525) at org.codehaus.jackson.map.type.TypeFactory.type(TypeFactory.java:61) at org.codehaus.jackson.map.ObjectMapper.<clinit>(ObjectMapper.java:179) at com.me.util.ctrl.BillingJobStatus.fromJson(BillingJobStatus.java:37)
我不明白
我猜您的Jackson JAR不同步。本JavaType类是jackson-coreJAR,和ObjectMapper类是在jackson- mapper。
JavaType
jackson-core
ObjectMapper
jackson- mapper
确保它们都是相同的版本。