简体   繁体   中英

jackson 2.4 looking for old class when deserialising

i am developing a restful service with tomcat 7 and jdk 1.6. for json handling i am using jackson 2.4.2 and it works fine except when i try and deserialise an object (that it has no trouble serialising).

the error is:

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

which is the place where jackson 1.x kept that particular class. my jackson 2.4.2 has it at

com.fasterxml.jackson.core.JsonFactory

i have no idea as to why it is trying to link the old class. i never used jackson 1.x.

what i use:

asm-3.3.1
commons-io-2.4
jackson-core-2.4.2
jackson-databind-2.4.2
jersey-bundle-1.18
mysql-connector-java-5.1.27

and

com.fasterxml.jackson.annotation

which i have taken from github. what library could be trying to import the old jackson module? any help would be much appreciated.

The issue certainly comes from trying to use Jackson 1.x ObjectMapper and missing underlying JsonFactory for 1.x. Since these come from difference jars (jackson-mapper-asl vs jackson-core-asl), it is likely that somehow one is missing.

Now, since you are not directly using Jackson 1.x, question is who is: perhaps jersey is relying on 1.x?

So there are two related questions: (a) if Jackson 1.x is needed, to bring in core jar as well, or (b) how to remove use of Jackson 1.x altogether.

Note that technically it is quite possible to use both 1.x and 2.x versions of Jackson, since 2.x was specifically designed to be able to co-exist. This to make upgrades easier, and allow gradual (component-by-component) upgrading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM