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
190 stars 98 forks source link

jersey-all and sling models #98

Closed ogebert closed 9 years ago

ogebert commented 9 years ago

We tried to install jersey-all in a OSGi container (Apache Felix, Sling) where Sling Models is also installed. Now all our bundles that are using javax.inject and javax.annotation have a problem with their dependency chain as inject and annotation are exported both in sling models and jersey all in different versions. The versions from jersey-all are newer - sling models uses: javax.annotation (0.0.0.1_007_JavaSE from org.apache.felix.framework) und javax.inject (0.0.0 from org.apache.sling.models.api).

Error message: 19.05.2015 14:36:09.274 INFO [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.RestartActiveBundlesTask Unable to start bundle de.publicis.mam.core [412] : Uses constraint violation. Unable to resolve bundle revision de.publicis.mam.core [412.11] because it is exposed to package 'javax.annotation' from bundle revisions org.apache.felix.framework [0] and com.eclipsesource.jaxrs.jersey-all [551.0] via two dependency chains.

Chain 1: de.ourbundle.core [412.11] import: (osgi.wiring.package=javax.annotation) | export: osgi.wiring.package=javax.annotation org.apache.felix.framework [0]

Chain 2: de.ourbundle.core [412.11] import: (&(osgi.wiring.package=de.ourcompany.aem.commons.components)(version>=2.7.0)(!(version>=3.0.0))) export: osgi.wiring.package=de.ourcompany.aem.commons.components; uses:=javax.annotation de.ourbundle.commons-core [554.3] import: (&(osgi.wiring.package=javax.annotation)(version>=1.2.0)(!(version>=2.0.0)))
export: osgi.wiring.package=javax.annotation

com.eclipsesource.jaxrs.jersey-all [551.0]

Is there a way to stop jersey-all to export those packages? Or would that lead to more problems?

BR, Oliver

hstaudacher commented 9 years ago

Hi Oliver, from a technical point of view we can stop exporting this in jersey-all. But then it would stop to be an "all" bundle because our security integration makes use of the annotation stuff. This would mean that you have to use an extra bundle if you want to use the security integration. Not an option for us.

Did you know that the jersey-all bundle is optional? It's just a convenience bundle. You can use the original jersey bundles too. Also you have the option to create your own jersey-all bundle which does not export the annotation stuff. Just clone our repo and execute mvn clean verify in build/com.eclipsesource.jaxrs.jersey.all. Please note you need to remove line 47 in the pom.xml to stop exporting the annotation packages.

Will close this issue now.

stefanseifert commented 9 years ago

you could also have a look at http://repo1.maven.org/maven2/io/wcm/osgi/wrapper/io.wcm.osgi.wrapper.jersey/2.17-0000/ - this is our own "all" bundles we use with osgi-jax-rs-connector; it contains all jersey bundles we need and direct dependencies, but not the external ones like javax.inject, they have to be deployed separately.

hstaudacher commented 9 years ago

Thanks @stefanseifert for sharing this.

ogebert commented 9 years ago

Thanks guys, I packaged my own bundle. Everything is working fine now.

skypajor commented 5 years ago

šŸ‘šŸŽ‰