karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@apache.org>
Subject Re: Problems after removing a feature repository in Karaf 4.0
Date Mon, 12 Dec 2016 14:58:45 GMT
2016-12-12 15:16 GMT+01:00 Frank_S <frank.sjegers@ikan.be>:

> Hi,
>
> we run our application in Karaf. It has a pluggable architecture in the
> sense that extra bundles get installed that perform certain services. The
> services are defined using Blueprint descriptors. For installing the
> bundles, we use the features framework of Karaf. More specifically, we
> generate a feature repository file, add the feature repository, install the
> feature, remove the feature repository, and then delete the generated
> feature repository file.
> This worked well in Karaf 2.4.0, but if we do this in Karaf 4.0, the first
> feature install succeeds, but a subsequent feature install yields the
> following exception :
>
> org.osgi.service.resolver.ResolutionException: Unable to resolve root:
> missing requirement [root] osgi.identity;
> osgi.identity=com.ikanalm.phase.echoparameters; type=karaf.feature;
> version="[1.0.0,1.0.0]";
> filter:="(&(osgi.identity=com.ikanalm.phase.echoparameters)(
> type=karaf.feature)(version>=1.0.0)(version<=1.0.0))"
>         at
> org.apache.felix.resolver.ResolutionError.toException(
> ResolutionError.java:42)[8:org.apache.karaf.features.core:4.0.7]
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(
> ResolverImpl.java:235)[8:org.apache.karaf.features.core:4.0.7]
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(
> ResolverImpl.java:158)[8:org.apache.karaf.features.core:4.0.7]
>         at
> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(
> SubsystemResolver.java:216)[8:org.apache.karaf.features.core:4.0.7]
>         at
> org.apache.karaf.features.internal.service.Deployer.
> deploy(Deployer.java:263)[8:org.apache.karaf.features.core:4.0.7]
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> doProvision(FeaturesServiceImpl.java:1176)[8:org.apache.karaf.features.
> core:4.0.7]
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(
> FeaturesServiceImpl.java:1074)[8:org.apache.karaf.features.core:4.0.7]
>         at java.util.concurrent.FutureTask.run(FutureTask.
> java:266)[:1.8.0_60]
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)[:1.8.0_60]
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)[:1.8.0_60]
>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
>
> The bundle com.ikanalm.phase.echoparameters, version 1.0.0 is the one that
> was installed using the generated feature repository file, which looks like
> this :
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.1"
> name="com.ikanalm.phase.echoparameters1.0.0_1481545020697">
> <feature name="com.ikanalm.phase.echoparameters" version="1.0.0">
> <bundle>file://SOMEPATH/com.ikanalm.phase.echoparameters-
> 1.0.0.jar</bundle>
> </feature>
> </features>
>
> The feature doesn't show up when I do "feature:list -i", and the feature
> repository isn't listed when I do "feature:repo-list". The bundle, however,
> is still installed, so our application is able to use it.
>
> Unfortunately, the feature is still listed in the requirements list of the
> “root” instance :
> karaf@root()> requirement-list
> Region | Requirement
> ---------------------------------------------------------------
> root   | feature:com.ikanalm.phase.echoparameters/[1.0.0,1.0.0]
>
> When I do a “requirement-remove” on the feature, the feature is
> uninstalled,
> and after that I can again install other features without the exception
> popping up, but regrettably, the bundle is also uninstalled, so that
> doesn't
> really help us.
>
> Is there a way to remove a requirement on an instance without uninstalling
> the feature or the bundle ? Or is the removal of the feature repository a
> bad idea, and are we wrong to use the feature framework merely as a
> “vessel”
> to get our bundles installed ?
>

You shouldn't really remove a repository if you haven't uninstalled the
features in that repository.  There's an additional check in 4.1 which
forbids you to do that (see https://issues.apache.org/jira/browse/KARAF-4060
).

And if you uninstall the feature, the bundles will be uninstalled if they
are not needed anymore.

The reason is that the Karaf 4 features service considers the set of
requirements and computes a set of bundles that need to be installed.  If
you remove a requirement on the feature, the bundle does not need to be
installed anymore.  And if you remove the repository, the requirement on
the feature can't be satisfied anymore.

There's no easy workaround for this specific problem: there's definitely no
way to keep a feature installed and remove the corresponding repository.
Why do you see keeping the repository as a problem ?



>
> Note again that this worked fine in Karaf 2.4.0.
>
> Thanks,
> Frank 'S Jegers.
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Problems-after-removing-a-feature-repository-in-Karaf-4-
> 0-tp4048979.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Mime
View raw message