karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kerry <karaf-u...@avionicengineers.com>
Subject Re: Include Karaf feature in POM dependency
Date Mon, 04 Dec 2017 21:50:29 GMT


On 30/11/17 17:00, Steinar Bang wrote:
>>>>>> Kerry <karaf-user@avionicengineers.com>:
>> Yes that is what I meant, I have to use a template to create a
>> features.xml. I've looked at the code for GenerateDescriptorMojo and
>> searched the Karaf source for an example of what I need but couldn't
>> find anything.
> I've created a feature request for this: https://issues.apache.org/jira/browse/KARAF-5512
>
>> Using the template technique I've also discovered that when I deployed
>> my feature it can fail. For example if I have 3 of my bundles A, B and
>> C in the feature such that:
>>   B depends on a service from C and A depends on B
>> deployment can fail due to a required service from C not being
>> available 'in-time' for B - I think that's what happening. If I deploy
>> the bundles individually everything works. I'll try playing around
>> with it but this is obviously nothing to do with the
>> GenerateDescriptorMojo.
> Hm... B should be robust enough to handle services arriving at any time
> and in any order.
>
> But if bundle B is outside of your control, then maybe you could force
> the correct load order in some way...?  Maybe a hiearchy of feature
> dependencies would do the trick?
>
> Ie. make a feature for C that loads C.  Then make a feature for B that
> loads bundle B and requires feature C.  Then make a feature for A that
> loads bundle A and requires feature B.
>
> Then make your feature be dependent on feature A.
>
> Something like that...?
>
>
Hi Steinar,

Sorry taken me a while to get back to you.

1. thanks for raising up the JIRA ticket I also would like to keep my features specification
within the POM if possible.

2. Regarding the resolving of bundles in a feature, I don't believe that it's because the
bundles are not robust, it's more like the feature deployer within Karaf isn't flexible enough
to allow services to become available that are provided within the same feature. I have created
an example here : https://github.com/jtkb/jpatest/blob/feature/karaf_features/simple-datasource/src/main/feature/feature.xml

If I try to deploy this feature I get the deployment error:
resolution:=mandatory [caused by: Unable to resolve com.javatechnics.jpa.simple/1.0.0.SNAPSHOT:
missing requirement [com.javatechnics.jpa.simple/1.0.0.SNAPSHOT] osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl; effective:=active]]

Remove the last bundle from the features.xml ('simple'), deploy the feature and THEN install
the 'simple' bundle manually it all works fine. Unless I am configuring my feature incorrectly
there doesn't seem to be a way of including DAO/persistence unit bundle AND the datasource
bundle within the same feature.

Kerry


Mime
View raw message