-
1. Re: org.osgi.framework.BundleException: Unresolved constraint in bundle
pchandler Sep 25, 2009 9:49 AM (in response to jokit)Jokit,
First thing to remember is, that in OSGi land resolving compile constraint and run-time constraints are two different things. The issue you are having is a run-time issue. So you can make FordonClient.jar into a bundle, deploy it, and then import it into your bundle (See Option1 & 2). Or you can put FordonClient.jar into the Bundle-ClassPath (Option3).
Most popular Java third party tool already exists as a bundle (search in OSGI Bundle Repository ORB. http://www.osgi.org/Repository/HomePage first!).
Options:
Introduce/Transform/Convert a non-OSGI jar into an OSGI bundle
1. Bnd - Bundle Tool
You could use command line tool "bnd", for more information about creating an OSGI bundle from a plain jar, please have a look at their web site http://www.aqute.biz/Code/Bnd. Also, "bnd" can be used in a POM file via the maven-bundle-plugin http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html.
2. Wrap Protocol
You could use pax-url-wrap and it is already available from the Fuse ESB 4.1. So basically, you could do something like:
osgi install -s wrap:mvn:com.mycompany/myProject/1.0-SNAPSHOT
Note, you could used file: instead of mvn: so it allows you to install a jar from your local file system. for instance:
osgi install -s wrap:file:///C:/temp/myProject.jar
For more information about pax-url-wrap, please have a look at http://wiki.ops4j.org/display/paxurl/Wrap+Protocol. Basically it uses the "bnd" tool mentioned below. Note: pax-url-wrap is a third party tool available via default in ServiceMix 4.1 (note: not available by default in Equinox.)
3. Creating a Bundle-ClassPath:
If the non-OSGi jar is to be private (i.e., not exported to other bundles) to a bundle you are creating then you create a Bundle-Classpath. Think of the Bundle-Classpath as a private/local/embedded classpath just for bundle.
To create a bundle-classpath without using e see: