Hello,

I would need some help/advice on the following use case, please (I am new to Karaf).

I would like to automatically have a feature be started, depending on the availability of a system capability.
But I am not quite sure, I am taking a right approach.

My feature, is related to clustering in our product and should be activated or not, based on a Java system property.

For now, I came up with the following system capability (which is working so far):

org.osgi.framework.system.capabilities= \
...
 ${jahia-cluster-activated-${cluster.activated}}

jahia-cluster-activated-false = org.jahia.cluster; activated="false"

jahia-cluster-activated-true = org.jahia.cluster; activated="true"


And my feature is defined as follows (removing the unrelated stuff):

    <feature name="jahia-clustering" version="${project.version}">
        <feature>cellar</feature>
        
<requirement>org.jahia.cluster;filter:="(&amp;(activated=true))"</requirement>
    </feature>


And here where I am stuck :-)
If I add my feature to the boot feature list (featuresBoot in org.apache.karaf.features.cfg) I am getting a failure on Karaf startup in case my system property cluster.activate=false:

2016-01-29 17:20:08,894 | ERROR | pool-21-thread-1 | BootFeaturesInstaller | 9 - org.apache.karaf.features.core - 4.0.4 | Error installing boot features org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=jahia-clustering; type=karaf.feature; version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]"; filter:="(&(osgi.identity=jahia-clustering)(type=karaf.feature)(version>=7.2.0.0-SNAPSHOT)(version<=7.2.0.0-SNAPSHOT))" [caused by: Unable to resolve jahia-clustering/7.2.0.0-SNAPSHOT: missing requirement [jahia-clustering/7.2.0.0-SNAPSHOT] org.jahia.cluster; filter:="(&(activated=true))"] at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)


And that prevents Karaf from starting.

I have a feeling that I am using not the right solution for my use case and would really appreciate any inputs / hints.

Thanks in advance

Kind regards
Sergiy

--

Sergiy Shyrkov
Software Architect
jahia.com


Reply via email to