By default the maven bundle plugin introspects your classes and the jars in
the maven build.
If you need a package then an import is created. If the jar offering the
packge has an OSGi Manifest then the version is taken from there if not
then it uses the maven version as package version.
>From this version bnd computes the import range. By default it uses the
exported version above cut to the minor version until excluding the next
major version.

You use this rs api to build your project:

      <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.1.1</version>
      </dependency>

So for example for the rs import it detrmined version 1.1.1 from the api
jar. The jar has no OSGi metadata.
So this creates an import range [1.1, 2).

The servicemix bundle for the spec exports version 2.0.1 which is outside
the spec.
You can configure the package imports by hand in
<configuration><instructions>.
This is fragile though.

One simple workaround is to use the servicemix spec bundle in your maven
build instead of the one you used.
JB mentioned that the exports of the servicemix bundle might be wrong.
Actually I do not know which exports would be correct. Spec bundles do not
always follow the semantic versioning.
So if you use the seervicemix jar be prepared to readjust if JB fixes the
export version.

There is also a difference in your specs to the one karaf offers. You used
jsr311 which I think is jax rs 2.0 while karaf offers jax rs 2.1. Normally
of course this should be compatible.

@JB I have no idea what the correct exports should be. I hope this is
defined in some OSGi spec.

Christian

Am Mo., 16. Sept. 2019 um 23:34 Uhr schrieb Greg Logan <
gregorydlo...@gmail.com>:

> Hi Christian,
>
> That's the really odd part: Neither the module pom (6.5: [1], 6.6: [2]),
> nor the main pom (6.5: [3]. 6.6: [4]) make any restriction on the package
> version.  Is there a way to enumerate which bits are imposing which
> restrictions?
>
> G
>
> 1: https://github.com/opencast/opencast/blob/6.5/modules/engage-ui/pom.xml
> 2: https://github.com/opencast/opencast/blob/6.6/modules/engage-ui/pom.xml
> 3: https://github.com/opencast/opencast/blob/6.5/pom.xml#L794
> 4: https://github.com/opencast/opencast/blob/6.6/pom.xml#L794
>
>
> On Mon, Sep 16, 2019 at 2:20 AM Christian Schneider <
> ch...@die-schneider.net> wrote:
>
>> You seem to be using the spec bundle :
>> org.apache.servicemix.specs.jsr339-api-2.0.1
>> This has
>> Export-Package: javax.ws.rs;version="2.0.1"
>> This version is outside the range < 2 you are looking for in your bundle.
>> So the question is of course why a spec bundle exports a 2.0.1 version of
>> this package. Maybe there is an error in the servicemix bundle.
>>
>> As a quick fix you can allow a package import >2 is your ui bundle.
>>
>> Christian
>>
>>
>> Am Fr., 13. Sept. 2019 um 23:24 Uhr schrieb Greg Logan <
>> gregorydlo...@gmail.com>:
>>
>>> Hi all,
>>>
>>> I'm hitting a very strange wiring issue with our features.  The error
>>> I'm seeing look like this:
>>>
>>> >feature:install opencast-adminpresentation
>>> org.osgi.service.resolver.ResolutionException: Unable to resolve root:
>>> missing requirement [root] osgi.identity;
>>> osgi.identity=opencast-adminpresentation; type=karaf.feature;
>>> version="[0,0.0.0]";
>>> filter:="(&(osgi.identity=opencast-adminpresentation)(type=karaf.feature)(version>=0.0.0)(version<=0.0.0))"
>>> [caused by: Unable to resolve opencast-adminpresentation/0.0.0: missing
>>> requirement [opencast-adminpresentation/0.0.0] osgi.identity;
>>> osgi.identity=opencast-engage-ui; type=osgi.bundle;
>>> version="[6.6.0,6.6.0]"; resolution:=mandatory [caused by: Unable to
>>> resolve opencast-engage-ui/6.6.0: missing requirement
>>> [opencast-engage-ui/6.6.0] osgi.wiring.package;
>>> filter:="(&(osgi.wiring.package=javax.ws.rs
>>> )(version>=1.1.0)(!(version>=2.0.0)))"]]
>>>         at
>>> org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:349)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1188)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1086)[6:org.apache.karaf.features.core:4.0.10]
>>>         at
>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_222]
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_222]
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_222]
>>>         at java.lang.Thread.run(Thread.java:748)[:1.8.0_222]
>>>
>>> This occurs on three of our profiles, all involving the
>>> opencast-engage-ui bundle.  The odd part is that this appears in our 6.6
>>> version, but *not* our 6.5 - but there's no part of the changeset between
>>> 6.5[1] and 6.6[2] which should be causing this.  We're using the servicemix
>>> bundle[3], which is the same across both of our 6.5 and 6.6 versions.  The
>>> bundle headers for 6.5 look like this:
>>>
>>> >bundle:headers opencast-engage-ui
>>>
>>> Opencast :: engage-ui (345)
>>> ---------------------------
>>> Bnd-LastModified = 1560502504114
>>> Build-Jdk = 1.8.0_212
>>> Build-Number = 618eec6
>>> Built-By = lars
>>> Created-By = Apache Maven Bundle Plugin
>>> Http-Alias = /engage/ui
>>> Http-Classpath = /ui
>>> Http-Welcome = index.html
>>> Manifest-Version = 1.0
>>> Tool = Bnd-3.5.0.201709291849
>>>
>>> Bundle-Category = opencastproject
>>> Bundle-Description = Opencast is a media capture, processing, management
>>> and distribution system
>>> Bundle-DocURL = http://opencastproject.org/
>>> Bundle-License = http://www.osedu.org/licenses/ECL-2.0/ecl2.txt
>>> Bundle-ManifestVersion = 2
>>> Bundle-Name = Opencast :: engage-ui
>>> Bundle-SymbolicName = opencast-engage-ui
>>> Bundle-Vendor = The Opencast Project
>>> Bundle-Version = 6.5.0
>>>
>>> But I'm not sure how to get the headers for 6.6 since the feature won't
>>> even start :(
>>>
>>> Any clues about how to proceed here?
>>>
>>> Thanks,
>>> G
>>>
>>> 1: https://github.com/opencast/opencast/releases/tag/6.5
>>> 2: https://github.com/opencast/opencast/releases/tag/6.6
>>>
>>> 3: 
>>> mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr339-api-2.0.1/2.6.0
>>>
>>
>>
>> --
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Computer Scientist
>> http://www.adobe.com
>>
>>

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Reply via email to