Wednesday, September 11, 2013

Karaf - WOW!!! What a container. Amazing OSGi

I am planning to write a detailed blog on my new trails with Karaf, specifically 2.3.0.

I will keep posting the the issues, I faced and finding the solutions / approaches for the same.

Issue-1 (not really one ;) )
JBossFuse:karaf@root> install -s mvn:com.dix.rest.services/PureBundle/1.0.0-SNAPSHOT
Bundle ID: 252
Error executing command: Error installing bundles:
        Unable to start bundle mvn:com.dix.rest.services/PureBundle/1.0.0-SNAPSHOT: Unresolved constraint in bundle PureBundle [252]: Unable to resolve 252.0: missing req
uirement [252.0] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))

Simple, way to solve this is to provide some package resolution within your pom.xml

example for this case of javax.ws.rs version wiring issues,

I used

<import-package>
javax.ws.rs.*;version="[1.1,3)",
org.apache.cxf.*;version="[2,4)",
*
</import-package>

This solved the issue. What happens here is that, the OSGi container's DI (Aries) looks to proxy my service definitions and couldn't understand as there were many versions / exports available from the already deployed bundles.

Hence, OSGi bundle plugin within your pom should have these import specs specified explicitly along with the versions you can adapt / accept.

No comments :

Post a Comment