OSGi missing requirement org.wiring.package = org.hsqldb when deploying Camel code to ServiceMix ( FuseESB )

StackOverflow https://stackoverflow.com/questions/14894051

Question

I've written some Camel code but when deploying to FuseESB v7.10 on Windows I get the following exception in the log:

Unable to resolve 337.0: missing requirement [337.0] 
osgi.wiring.package; (&(osgi.wiring.package=org.hsqldb)(version>=1.8.0.7)  
(!(version>=2.0.0))) at   
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4054)

The project is written using a Blueprint OSGi xml file to define the beans, then built with Maven, as a jar (as opposed to an OSGi bundle) and then hot deployed to the deploy directory, so it is deployed by the FuseESB FAB deployer. It doesn't have an explicit dependency on HSQLDB in the Maven POM, so I assume this is a transitive dependency. However, I've tried to install what I think is the relevant bundle with:

osgi:install mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hsqldb/1.8.0.10_2

This bundle is now shown as active in the Karaf console:

[335] [Active] [ ] [ ] [ 60] Apache ServiceMix :: Bundles :: hsqldb (1.8.0.10_2)

If I run the command packages:exports it seems to show that the correct dependency is exported by this bundle:

FuseESB:karaf@root> packages:exports 335
ID Packages
335 org.hsqldb.resources; version=1.8.0.10
335 org.hsqldb.types; version=1.8.0.10
335 org.hsqldb.jdbc; version=1.8.0.10
335 org.hsqldb.scriptio; version=1.8.0.10
335 org.hsqldb.rowio; version=1.8.0.10
335 org.hsqldb.store; version=1.8.0.10
335 org.hsqldb.index; version=1.8.0.10
335 org.hsqldb.persist; version=1.8.0.10
335 org.hsqldb.lib.java; version=1.8.0.10
335 org.hsqldb.util.sqltool; version=1.8.0.10
335 org.hsqldb; version=1.8.0.10
335 org.hsqldb.sample; version=1.8.0.10
335 org.hsqldb.util; version=1.8.0.10
335 org.hsqldb.lib; version=1.8.0.10

However my bundle still fails to start, and gives the same error. Any ideas?

Was it helpful?

Solution 2

You can add the HSQLDB as a depedendecy to your project in your pom.xml file. Then FAB should install it automatic and have it included in the classpath space.

If you want to pre-install it, or use a shared bundle, then you can define the scope as

<scope>provided</scope>

Then FAB will use the shared bundle. You can read about this here: http://fuse.fusesource.org/bundle/overview.html

There is also a new SQL example with the upcoming Camel 2.11 at: http://camel.apache.org/sql-example.html. It works in OSGi as well, as we have a features.xml file included in the example at: https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-sql/

Though we had to add dynamic import in the felix-bundle-plugin due the usual OSGi pain :(

OTHER TIPS

Okay I see the problem: it's a misunderstanding about versions.

The HSQLDB bundle you have installed is exporting package org.hsqldb as version 1.8.0.10. Your bundle requires at least version 1.8.0.7. You may think this is not a problem but in fact 1.8.0.10 is less than 1.8.0.7!!

OSGi versions have three numeric segments (Major, minor, micro) and one alphanumeric segment called the qualifier. Here, the qualifiers are "10" and "7" respectively. When compared as alphanumeric strings, "10" is less than "7" because the first character of "10" is 1 and this comes before 7. For reference, qualifiers are compared using the String.compare() method from the standard Java library, so refer to the JavaDocs for that method to get a full description of the algorithm.

How to solve this? Well your bundle 337 (whatever it is) is being far, FAR too specific about the version it requires. It should probably import anything from 1.8 upwards as follows: [1.8,2.0)... or even anything from version 1 upwards: [1, 2).

Also as a side note I think that the author of HSQLDB has made a mistake in using what looks like a number in the qualifier segment. However unless you are the author of HSQLDB yourself, I assume there's not much you can do about this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top