I am working on a web application managed by Apache ant builder. We recently upgraded jersey from 2.17 to 2.35 and all the related dependencies in the class path. After upgrading i noticed one error where the PSOT method argument is populated as null.
Did some digging to solve this issue, found jersey-media-json-binding.jar might be causing the issue. Removed it from class path, and everything works fine.
But I am unable to figure why did the issue cause in the first place, what is the use of this jersey-media-json-binding.jar library.
Does jersey-media-json-binding.jar and jackson-jaxrs-json-provider-2.12.2.jar provide the same functionality, which is causing the issue?
CodePudding user response:
JSON-B is the new default provider. If you have it on the classpath (without explicit registration of other providers), it will be used. The default used to be MOXy. If you want Jackson to be used regardless of which provider is on the classpath, just register the JacksonFeature
with your application. All three of these providers are used for JSON support, but they all have different behaviors in regards to (de)serialization. Also, all of these provider modules have auto-registration, meaning you don't have to explicitly register them. But there is predefined behavior as to which one will take priority (if more than one is present). So if you want a specific one to be used, regardless of which are on the classpath, just register its feature (i.e. JacksonFeature
, JsonBindingFeature
, MoxyJsonFeature
).