hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
191 stars 98 forks source link

jersey-all missing required export package statement for Jackson #164

Open seanrohead opened 8 years ago

seanrohead commented 8 years ago

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?

BryanHunt commented 8 years ago

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.

mistriel commented 7 years ago

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

BryanHunt commented 7 years ago

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.