Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using Jackson sample code to deserialize a POJO:

ObjectMapper m = new ObjectMapper();

This line throws a 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)

I don't get it

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
372 views
Welcome To Ask or Share your Answers For Others

1 Answer

I'm guessing your Jackson JARs are out of sync. The JavaType class is in the jackson-core JAR, and the ObjectMapper class is in jackson-mapper.

Make sure these are both of the same version.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...