Search code examples
osgiapache-servicemixblueprint-osgifuseesb

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


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?


Solution

  • 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 :(