hstaudacher/osgi-jax-rs-connector

jersey-all missing required export package statement for Jackson

Opened this issue · 3 comments

I have been using publisher 4.1 and jersey-all 2.8. I upgraded to publisher 5.3.1 and jersey-all 2.22.2 and my REST resource was no longer able to deserialize JSON using Jackson. I stepped through the Jackson code and discovered that jersey-all has a private version of the com.fasterxml.jackson.annotation package. When I added an export for com.fasterxml.jackson.annotation;version="2.7.0" to the manifest of jersey-all, my problems went away.

The problem is this: My JSON objects are annotated with Jackson annotations so this bundle has an osgi import for com.fasterxml.jackson.annotation. Since jersey-all is not exporting this package, I had to manually install the jackson annotations bundle (com.fasterxml.jackson.core:jackson-annotations:2.7.0) so that my bundle would resolve. However, when the jackson implementation inside jersey-all looks at the annotations on my json objects, it doesn't recognize them, because @JsonCreator and @JsonProperty on my json objects were loaded from the jackson-annotations bundle, but the jackson implementation loaded these same classes from the jersey-all bundle. When i added com.fasterxml.jackson.annotation to the list of exported packages in jersey-all and removed the jackson-annotation bundle, everything started working again.

Can you please add this export to the next version of jersey-all?

I might suggest switching to the jersey-min bundle and adding the dependencies. It is more work on your part, but I believe that is a better architecture in the end.

I also dont get it,
jersey-all-2.22.2.jar includes: com.fasterxml.jackson.* but does not export them in the manifest.
Why ?

FYI, one of the things I'm going to work on soon is to clean up how the jersey bundles are consumed and sort out all of the imports / exports.