3

I have a features.xml with a few bundles listed. But they all need to be installed apparently. So all that the features.xml does is gather the dependencies in one spot....

Unless I am horribly mistaken. In which case how does one resolve a situation where I have a lot of dependencies in features.xml and they are all not in any order. Right now I am going through the exercise of installing each bundle and starting them up one by one...

Tell me what I am doing wrong- of which there may be several things

Edit: Features were generated by maven plugin. When I install feature, I get unresolved error

Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=myBundleApp; type=karaf.feature; version="[1.0.0.RC1,1.0.0.RC1]"; filter:="(&(osgi.identity=myBundleApp)(type=karaf.feature)(version>=1.0.0.RC1)(version<=1.0.0.RC1))" [caused by: Unable to resolve myBundleApp/1.0.0.RC1: missing requirement [myBundleApp/1.0.0.RC1] osgi.identity; osgi.identity=org.eclipse.jetty.websocket.server; type=osgi.bundle; version="[9.3.6.v20151106,9.3.6.v20151106]"; resolution:=mandatory [caused by: Unable to resolve org.eclipse.jetty.websocket.server/9.3.6.v20151106: missing requirement [org.eclipse.jetty.websocket.server/9.3.6.v20151106] osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"]]

But the feature.xml already has <bundle>mvn:org.eclipse.jetty.websocket/websocket-server/9.3.6.v20151106</bundle>

timlyo
  • 2,086
  • 1
  • 23
  • 35
treefrog
  • 1,027
  • 1
  • 15
  • 30

1 Answers1

4

The point of features.xml is to define a repository of features that can be used to provision an OSGi application in Apache Karaf. In another words, it's purpose is exactly to NOT have to install bundles manually! As documentation states:

When you install a feature, Apache Karaf installs all resources described in the feature. It means that it will automatically resolves and installs all bundles, configurations, and dependency features described in the feature.

That said, please keep in mind:

  • this is Karaf specific functionality. It will not work with other OSGi containers
  • before you can install a feature you need to make Karaf aware of the repository containing it. You can use feature:repo-list command to check what repos Karaf is aware of and feature:repo-add command to add repositories. Please see this documentation for more details.
  • URLs pointing to bundles, features, configurations, ... inside features.xml have to point to a reasoures Karaf understands and can access
  • Features (much like bundles) need to be resolved before they be activated.
Milen Dyankov
  • 2,972
  • 14
  • 25
  • 1
    "Features" is standard OSGi. "features.xml" is Apache Karaf (and can be used elsewhere by installing the "Feature" bundles. IBM Websphere/Liberty, on the other hand, typically uses "feature manifests": https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_feat_definition.html – paulsm4 Jan 29 '18 at 19:06