Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

spring - Which JAR file contains the JsonProcessingException class?

When I try to use Jackson 2.1.1 with the following jar files (in Spring 3.2.2),

  • jackson-core-2.1.1.jar
  • jackson-annotations-2.1.1.jar
  • jackson-databind-2.1.1.jar

I get the following exception.

java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException

So I think, the class JsonProcessingException is contained by the jackson-core-asl-2.1.1.jar file (I'm not quite sure though) but I cannot see this file in the download. So where to get this file to resolve that exception?


jackson-all-1.9.8.jar contains necessary classes including the class org.codehaus.jackson.JsonProcessingException and JSON also works fine but I'm not sure this is perfectly compatible as I'm using classes from Jackson 2.1.1 for object mapping. Therefore I'm looking for the jackson-core-asl-2.1.1.jar file but I can't see such a JAR file. I can only see 1.x.x versions here.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

In version 2.1.2, that class is called com.fasterxml.jackson.core.JsonProcessingException, and it's in the jackson-core jar. Jackson changed its packaging for version 2.0, along with numerous other things.

It seems you have some code that was written against an older version of Jackson, and is trying to load the class under an old name. You will need to either update this code, or use an old version of Jackson.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...