You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2017/05/01 06:48:39 UTC

Re: Pax Exam test with embedded karaf container: One mvn dependency in feature must be preloaded

>>>>> Steinar Bang <sb...@dod.no>:

>>>>> Steinar Bang <sb...@dod.no>:
>> But that failed on startup with a strange error message, and was fixed
>> by a strange cure.

>> The error message I got, was:
>> 2017-04-17 16:04:54,117 | ERROR | FelixStartLevel  | BootFeaturesInstaller            | 6 - org.apache.karaf.features.core - 4.0.9 | Error installing boot features
>> org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn/1.0.0.SNAPSHOT: missing requirement [ukelonn/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=no.priv.bang.ukelonn; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve no.priv.bang.ukelonn/1.0.0.SNAPSHOT: missing requirement [no.priv.bang.ukelonn/1.0.0.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.apache.shiro.authc)(version>=1.3.0)(!(version>=2.0.0)))"]]
>>       at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
>>       at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:389)
>>       at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:375)
>>       at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:347)
>>       at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)
>>       at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)
>>       at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)
>>       at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)
>>       at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
>>       at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_121]
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_121]
>>       at java.lang.Thread.run(Unknown Source)[:1.8.0_121]

> I have no idea how or why, but karaf stopped requiring the preloaded
> bundle.  Now it works as expected, with the dependency loaded from the
> feature: 
>  https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.tests/src/test/java/no/priv/bang/ukelonn/tests/UkelonnServiceIntegrationTest.java#L37

> I haven't tried building from a clean workspace and clean
> ~/.m2/repository (I will cross that bridge if I get to it).

FWIW I think that all of the weirdness I saw was caused by me using
three different versions of osgi core to build the various bundles.

When I moved to karaf 4.1.1 and OSGi 6.0 I cleaned up all of that and
all bundles now have the same version of OSGi core (and the need for the
troublesome OSGi compendium went away):
 https://github.com/steinarb/ukelonn/commit/9fc41d0ee19b5758526bc8165667569e697dfa36


The reason for the different osgi.core versions in the project predates
my move to karaf, where I wanted my app to run both with "mvn
pax:provision" and running from a manually set up pax exam test.  This
required quite a bit of trial and error experimentation.

I think part of my reluctance to make the move to karaf last autumn, was
that I had invested so much time and effort into making the "mvn
pax:provision" run, and the manually set up pax exam test load the
bundles right... I didn't just want to throw that effort away...:-)

But now I'm glad I did. :-)