FasterXML / jackson-datatype-joda

Extension module to properly support full datatype set of Joda datetime library
Apache License 2.0
140 stars 82 forks source link

NoSuchFieldError when initializing JodaModule in 2.5.1 #57

Closed geekbeast closed 9 years ago

geekbeast commented 9 years ago

There seems to be a reference to a non-existent field SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS.

We had to roll back to 2.4.4 in all our projects as a result.

cowtowncoder commented 9 years ago

It sounds like you have a version mismatch so that jackson-databind is a version older than 2.4. Joda module itself would not compile if field was missing.

geekbeast commented 9 years ago

Will investigate further, there might be an external transitive dependency pulling in an older version that we're missing.

geekbeast commented 9 years ago

This seems to be happening even when jackson-databind is up to date. We are getting serialization errors when we try to globally bump all projects to 2.5.1.

We manually made sure all the latest version of everything are in the gradle distZip as well. Going to see if we can get a consistent repro that doesn't require our binaries.

thomas-mc-work commented 9 years ago

I'm having the same problem when using GlassFish 4.1 whereas Payara can deal with it. Additionally I've found out that jersey-media-json-jackson depends on old version of jackson (e.g. jackson-databind:2.3.2) which could cause the conflict. However when I remove this dependency it's still failing.

cowtowncoder commented 9 years ago

@thomas-mc-work Minor version do have to match, and simply removing dependency does not typically force same set of versions. Maven's handling of transitive dependencies is not very good at coming up with consensus there (either due to it not having enough info, or not having heuristics). So: having 2.3 of databind, 2.5 of a module is not going to work.

jnwelzel commented 9 years ago

Dropwizard 0.8.1 packs the 2.5.1 jackson and i'm having this same problem when i try to fire up my app.

edit: fixed it by using mvn dependency:tree to identify what other libs of my app had jackson dependencies in them, then I proceeded to add jackson exclusions in my pom for each one of those, only allowing the dropwizard jackson deps and it worked.

cowtowncoder commented 9 years ago

@jnwelzel Thank you for confirming what appears to be happening. It is unfortunate that this is how it goes -- I wonder if DropWizard might be relying on transitive dependencies, leading to minor conflict.

geekbeast commented 9 years ago

We forced resolution of all jackson libs in gradle to 2.5.1 and were unable to get it work. That said it seems like an issue with transitive dependencies. Should I close the bug?

cowtowncoder commented 9 years ago

@geekbeast If things are still not working, I think it is better to keep this open. One more thing to try: since the latest 2.5.x release is 2.5.3, could you try upgrade to those versions?

cowtowncoder commented 9 years ago

For sake of completeness, I will just note that SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS was added in Jackson 2.5. Given this, 2.5 (and above) versions of jackson-datatype-joda will require jackson-databind version of at least 2.5. It is strongly recommended to keep same minor versions anyway, but in this case that is absolutely necessary because Joda module uses this feature for its configuration.

UnsungHero97 commented 9 years ago

Just wanted to confirm that we're still seeing this in our build on 2.5.3. We're going to try and bump to the latest version of all these projects.

batcer commented 8 years ago

@UnsungHero97 have you fixed that in your projects?