1

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.

Brett Schneider
  • 3,993
  • 2
  • 16
  • 33

1 Answers1

1

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.

StaxMan
  • 113,358
  • 34
  • 211
  • 239
  • from my understanding the problem seems to lie within jackson's json provider. the messagebodywriter seemingly works whereas the messagebodyreader appears to be carrying the old import. i have ruled out the other jars as the source of the problem as i have used them all beforehand whilst still using xml – Brett Schneider Oct 15 '14 at 12:27
  • That is odd, since there really should not be any dependencies from 2.x to 1.x. If you do figure out where the import comes I will happy to help remove it. – StaxMan Oct 20 '14 at 23:07
  • for the time being i added the jackson-mini-1.9 jar to my project and can now work with it. should i find out, i'll let you know. thank you for taking time to look at my question – Brett Schneider Oct 21 '14 at 12:40