Osgi bundle version of the libraries

I’ve been looking lately at the solution to manage our apps via Karaf (deploy/start/stop/monitor) and since strata is part of the solution I bundled them using a wrapper.

No success since I get all kind of errors, mostly “Unsatisfied Requirements” either for the library packages or for packages used (joda)

Thing is I’m new to both (strata and OSGI Karaf).

Any hints that would move me forward?

Thanks!

it seems strata basics makes use of joda-beans "org.joda.beans.impl.direct.DirectMetaBean"
but the joda-beans bundle does not export the packaged used by strata…

In order to be able to resolve a package, Karaf tries to match whatever is in a bundle “imports” with whatever other bundles “export”.

Exported Packages	org.joda.beans,version=1.8.0
	org.joda.beans.gen,version=1.8.0
	org.joda.beans.integrate.freemarker,version=1.8.0
	org.joda.beans.integrate.mongo,version=1.8.0
	org.joda.beans.query,version=1.8.0
	org.joda.beans.ser,version=1.8.0
	org.joda.beans.ser.bin,version=1.8.0
	org.joda.beans.ser.json,version=1.8.0
	org.joda.beans.ser.xml,version=1.8.0
	org.joda.beans.test,version=1.8.0

Could there be a reason why org.joda.beans.impl. is not exported? Hmm…

UPDATE:
By repacking joda-beans to get rid of unwanted packages and advertise the needed one

org.joda.beans.impl.direct

I was able to make use of strata from karaf. Here’s my bnd file that repacks joda-beans

this-name: joda-beans
this-version: 1.8
-include: common.bnd
-classpath:../jars/${bndl-name}.jar
Import-Package: \
	!com.mongodb.*, \
	!freemarker.ext.beans.*, \
	!freemarker.template.*, \
	!org.joda.collect.grid.*, \
	!org.joda.beans.integrate.*, \
	*
Export-Package: \
	!com.mongodb.*, \
	!freemarker.ext.beans.*, \
	!freemarker.template.*, \
	!org.joda.beans.integrate.*, \
	!org.joda.collect.grid.*, \
	!org.joda.beans.test.*, \
	*;version=${this-version}

Thanks for the update, and glad you got things working. Looks like we need to update Joda-Beans OSGI setup.

1 Like

Just make sure you export whatever it’s needed and mark optional everything else, setting the version range as well if needed.

I didn’t need mongodb, freemarker or the other features of the joda beans and by using the above I managed to make my piece work.

Just my 2¢

The projects like Mongo and Freemarker are marked as optional in OSGI as well and in Maven.

Please see Joda-Beans v1.11 to see if it fixes the problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.