You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Martin Lichtin <li...@yahoo.com> on 2017/05/23 08:44:04 UTC

Problem with Karaf 4 feature installation

I'm in the process of moving a system from Karaf 3 to 4.0. The 4.0 'features' changes turn out to be quite painful to upgrade..

In particulur, with Pax-Exam, I have a situation with a feature B, where bundle B requires a service from bundle A, from feature A:

<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="B">
  <repository>mvn:grp/artifact-A/1.0/xml/features</repository>
    <feature name="B">
        <feature prerequisite="true">A</feature>
        <bundle>mvn:grp/bundle-B/1.0</bundle>
    </feature
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="A">
    <feature prerequisite="true">aries-blueprint</feature>
    <feature prerequisite="true">deployer</feature>
    <feature name="A">
        <bundle>blueprint:mvn:grp/bundle-A/1.0/xml/idA</bundle>
    </feature
</features>

The location and name of feature "B" is provided to Pax-Exam to install it.
What is puzzling is that I see how the "blueprint" XML file is downloaded and the BlueprintURLHandler
seems to kick in, but at about the same time the Resolver throws a "missing requirement"
regarding bundle-B missing the service that bundle-A is about to provide.
At this time, blueprint bundle-A has not been fully activated yet.
But should not the prerequisite=true assure that services from bundle A are all visible
before bundle B is installed and resolved?

In another, similar situation it seems to work, so perhaps the special "blueprint:" loader is an issue?
Any other ideas how to better debug? I turn on org.apache.karaf TRACE but no real info comes out.

- Martin

Re: Problem with Karaf 4 feature installation

Posted by lichtin <li...@yahoo.com>.
That's very interesting, thanks. 
The BlueprintTransformer class creates a minimal Manifest with no headers
declaring a service.
So the header you mention definitely is missing when using the blueprint:
deployer mechanism.

I see my regular bundles still have an Export-Service header (created by
maven-bundle-plugin 2.4.0).
So I try and add the following to my blueprint.xml:

  <manifest xmlns="http://karaf.apache.org/xmlns/deployer/blueprint/v1.0.0">
    Export-Service=my.pkg;attr1=val1
  </manifest>

and indeed now the feature requirements resolution seems to work! Thanks,
Chris.

And yes, Export-Service is deprecated, but there's only so much one can
learn in a day.. :)
Guess I need to look into upgrading the maven-bundle-plugin.

- Martin


The requirements are solved purely with the Provide-Capability headers of
the bundles. It does not matter if bundle A actually provides such a
service. The important thing is that bundle A has a suitable
Provide-Capabilitiy Manifest header to announce it will provide a suitable
service. If this is not the case then you should make sure the header is
added. If you can not change the bundle then you can also add the
capability in the feature.

Christian

2017-05-23 10:44 GMT+02:00 Martin Lichtin &lt;lichtin@&gt;:

> I'm in the process of moving a system from Karaf 3 to 4.0. The 4.0
> 'features' changes turn out to be quite painful to upgrade..
>
> In particulur, with Pax-Exam, I have a situation with a feature B, where
> bundle B requires a service from bundle A, from feature A:
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="B">
>   <repository>mvn:grp/artifact-A/1.0/xml/features</repository>
>     <feature name="B">
>         <feature prerequisite="true">A</feature>
>         <bundle>mvn:grp/bundle-B/1.0</bundle>
>     </feature
> </features>
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="A">
>     <feature prerequisite="true">aries-blueprint</feature>
>     <feature prerequisite="true">deployer</feature>
>     <feature name="A">
>         <bundle>blueprint:mvn:grp/bundle-A/1.0/xml/idA</bundle>
>     </feature
> </features>
>
> The location and name of feature "B" is provided to Pax-Exam to install
> it.
> What is puzzling is that I see how the "blueprint" XML file is downloaded
> and the BlueprintURLHandler
> seems to kick in, but at about the same time the Resolver throws a
> "missing requirement"
> regarding bundle-B missing the service that bundle-A is about to provide.
> At this time, blueprint bundle-A has not been fully activated yet.
> But should not the prerequisite=true assure that services from bundle A
> are all visible
> before bundle B is installed and resolved?
>
> In another, similar situation it seems to work, so perhaps the special
> "blueprint:" loader is an issue?
> Any other ideas how to better debug? I turn on org.apache.karaf TRACE but
> no real info comes out.
>
> - Martin



--
View this message in context: http://karaf.922171.n3.nabble.com/Problem-with-Karaf-4-feature-installation-tp4050416p4050422.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Problem with Karaf 4 feature installation

Posted by Christian Schneider <ch...@die-schneider.net>.
The requirements are solved purely with the Provide-Capability headers of
the bundles. It does not matter if bundle A actually provides such a
service. The important thing is that bundle A has a suitable
Provide-Capabilitiy Manifest header to announce it will provide a suitable
service. If this is not the case then you should make sure the header is
added. If you can not change the bundle then you can also add the
capability in the feature.

Christian

2017-05-23 10:44 GMT+02:00 Martin Lichtin <li...@yahoo.com>:

> I'm in the process of moving a system from Karaf 3 to 4.0. The 4.0
> 'features' changes turn out to be quite painful to upgrade..
>
> In particulur, with Pax-Exam, I have a situation with a feature B, where
> bundle B requires a service from bundle A, from feature A:
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="B">
>   <repository>mvn:grp/artifact-A/1.0/xml/features</repository>
>     <feature name="B">
>         <feature prerequisite="true">A</feature>
>         <bundle>mvn:grp/bundle-B/1.0</bundle>
>     </feature
> </features>
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="A">
>     <feature prerequisite="true">aries-blueprint</feature>
>     <feature prerequisite="true">deployer</feature>
>     <feature name="A">
>         <bundle>blueprint:mvn:grp/bundle-A/1.0/xml/idA</bundle>
>     </feature
> </features>
>
> The location and name of feature "B" is provided to Pax-Exam to install it.
> What is puzzling is that I see how the "blueprint" XML file is downloaded
> and the BlueprintURLHandler
> seems to kick in, but at about the same time the Resolver throws a
> "missing requirement"
> regarding bundle-B missing the service that bundle-A is about to provide.
> At this time, blueprint bundle-A has not been fully activated yet.
> But should not the prerequisite=true assure that services from bundle A
> are all visible
> before bundle B is installed and resolved?
>
> In another, similar situation it seems to work, so perhaps the special
> "blueprint:" loader is an issue?
> Any other ideas how to better debug? I turn on org.apache.karaf TRACE but
> no real info comes out.
>
> - Martin
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>