Hello The three "double chains" you've shown are quite easy to explain and solve. The reason is - both pax-web-api and org.osgi.service.http.whiteboard bundles are exporting the same package. While with custom APIs it's desirable from the point of view of versioning, canary deployments, etc., it's always a problem when dealing with "fundamental" APIs.
Simply - if you install pax-web-api you CAN'T install these: * https://repo1.maven.org/maven2/org/osgi/org.osgi.service.http/1.2.2/org.osgi.service.http-1.2.2.jar * https://repo1.maven.org/maven2/org/osgi/org.osgi.service.http.whiteboard/1.1.1/org.osgi.service.http.whiteboard-1.1.1.jar Looks like you're using Felix, not Karaf. If you look at Karaf features - https://github.com/ops4j/org.ops4j.pax.web/blob/main/pax-web-features/src/main/resources/features.xml you'll see which bundles are needed. For example, Jetty 9 is still compatible with Servlet API 3.1 only, that's why Pax Web provides something called "org.ops4j.pax.web/pax-web-compatibility-servlet31" bundle - a fragment that attaches to Jakarta Servlet API 4 bundle to export additional (fake) Servlet API packages with version 3.1 - that's enough to keep Jetty 9 bundles satisfied. You may (and should ;) ask - why? Why we don't do canonical OSGi and use bundles where there's one? Well - it's all about history. Pax Web was created hundreds of years ago, back in time when there was only "osgi-cmpn" (or "osgi-enterprise") bundle exporting EVERYTHING, not only particular service. Only recently ("recently" in terms of OSGi life) separate APIs were published as separate bundles (cm, eventadmin, http, whiteboard, ...). So if you use Pax Web, you have to adjust to some practically good, canonically not-that-good rules. You can always check https://github.com/ops4j/org.ops4j.pax.web/blob/main/pax-web-itest/pax-web-itest-common/src/main/java/org/ops4j/pax/web/itest/AbstractControlledTestBase.java which shows which bundles are needed to satisfy particular Pax Web area (JSP, Whiteboard, WAR, ...). I hope this answer is helpful regards Grzegorz Grzybek niedz., 17 mar 2024 o 17:15 Alain Picard <[email protected]> napisaĆ(a): > Finally getting around to get this one done but facing a few issues and > have a few questions. > > First I started trying to go to version 8, but was having issues where in > some places OSGi would resolve to version 10 instead of 9 (we have both > since Eclipse help is on 10 and part of our app) even if my range max was < > 10. But then I found out on the Jetty site that version 9 is EOL since 2022 > and now even version 10 is EOL since January 1st. So that sealed the deal > to go with version 10 at least. > > This did bring some resolution issues with Servlet 3.1 vs Servlet 4 and > still have one left to resolve. Wonder if anyone has great insight on best > way to handle this, but I believe that I can get it done, even if some > bundles have no range specified (and here again we can't get rid of 3.1 > since used by some bundles). > > Now for the tricky part that I just can't figure out. I am getting a > resolution issue that seems to be from within pax web and I can't > understand it. I am mostly (except 1 place where I can't) declaring my > dependencies on osgi interface and just including the pax web bundles as > part of my launch. > > Here is the reported issue, where I have 3 cases where there appears to be > conflicts resolving 'org.osgi.service.http.context', 2 that are pax web > only and one involving Aries: > !MESSAGE FrameworkEvent ERROR > !STACK 0 > org.osgi.framework.BundleException: Could not resolve module: > org.ops4j.pax.web.pax-web-runtime [509] > Unresolved requirement: Import-Package: org.jasypt.encryption; > resolution:="optional" > Unresolved requirement: Import-Package: org.jasypt.encryption.pbe; > resolution:="optional" > Unresolved requirement: Import-Package: > org.jasypt.encryption.pbe.config; resolution:="optional" > Unresolved requirement: Import-Package: org.jasypt.commons; > resolution:="optional" > Bundle was not resolved because of a uses constraint violation. > org.apache.felix.resolver.reason.ReasonException: Uses constraint > violation. Unable to resolve resource org.ops4j.pax.web.pax-web-runtime > [osgi.identity; osgi.identity="org.ops4j.pax.web.pax-web-runtime"; > type="osgi.bundle"; version:Version="9.0.15"] > because it is exposed to package > 'org.osgi.service.http.context' from resources > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] and > org.ops4j.pax.web.pax-web-api [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-api"; type="osgi.bundle"; > version:Version="9.0.15"] via two dependency chains. > > Chain 1: > org.ops4j.pax.web.pax-web-runtime [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-runtime"; type="osgi.bundle"; > version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.osgi.service.http.context)(&(version>=1.1.0)(!(version>=2.0.0)))) > | > export: osgi.wiring.package: org.osgi.service.http.context > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] > > Chain 2: > org.ops4j.pax.web.pax-web-runtime [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-runtime"; type="osgi.bundle"; > version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.ops4j.pax.web.service.whiteboard)(version>=9.0.15)) > | > export: osgi.wiring.package: org.ops4j.pax.web.service.whiteboard; > uses:=org.osgi.service.http.context > export: osgi.wiring.package=org.osgi.service.http.context > org.ops4j.pax.web.pax-web-api [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-api"; type="osgi.bundle"; > version:Version="9.0.15"] > > !ENTRY org.ops4j.pax.web.pax-web-extender-whiteboard 4 0 2024-03-15 > 07:25:16.520 > !MESSAGE FrameworkEvent ERROR > !STACK 0 > org.osgi.framework.BundleException: Could not resolve module: > org.ops4j.pax.web.pax-web-extender-whiteboard [639] > Bundle was not resolved because of a uses constraint violation. > org.apache.felix.resolver.reason.ReasonException: Uses constraint > violation. Unable to resolve resource > org.ops4j.pax.web.pax-web-extender-whiteboard [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-extender-whiteboard"; > type="osgi.bundle"; version:Version="9.0.15"] because it is exposed to > package 'org.osgi.service.http.context' from resources > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] and org.ops4j.pax.web.pax-web-api > [osgi.identity; osgi.identity="org.ops4j.pax.web.pax-web-api"; > type="osgi.bundle"; version:Version="9.0.15"] via two dependency chains. > > Chain 1: > org.ops4j.pax.web.pax-web-extender-whiteboard [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-extender-whiteboard"; > type="osgi.bundle"; version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.osgi.service.http.context)(&(version>=1.1.0)(!(version>=2.0.0)))) > | > export: osgi.wiring.package: org.osgi.service.http.context > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] > > Chain 2: > org.ops4j.pax.web.pax-web-extender-whiteboard [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-extender-whiteboard"; > type="osgi.bundle"; version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.ops4j.pax.web.service.whiteboard)(version>=9.0.15)) > | > export: osgi.wiring.package: org.ops4j.pax.web.service.whiteboard; > uses:=org.osgi.service.http.context > export: osgi.wiring.package=org.osgi.service.http.context > org.ops4j.pax.web.pax-web-api [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-api"; type="osgi.bundle"; > version:Version="9.0.15"] > > !MESSAGE FrameworkEvent ERROR > !STACK 0 > org.osgi.framework.BundleException: Could not resolve module: > org.apache.aries.jax.rs.whiteboard [541] > Unresolved requirement: Require-Capability: osgi.implementation; > filter:="(&(osgi.implementation=osgi.http)(version>=1.0.0)(!(version>=2.0.0)))" > -> Provide-Capability: osgi.implementation; version:Version="1.1.0"; > osgi.implementation="osgi.http"; > uses:="javax.servlet,javax.servlet.http,org.osgi.service.http.context,org.osgi.service.http.whiteboard" > org.ops4j.pax.web.pax-web-runtime [509] > Unresolved requirement: Import-Package: org.jasypt.encryption; > resolution:="optional" > Unresolved requirement: Import-Package: > org.jasypt.encryption.pbe; resolution:="optional" > Unresolved requirement: Import-Package: > org.jasypt.encryption.pbe.config; resolution:="optional" > Unresolved requirement: Import-Package: org.jasypt.commons; > resolution:="optional" > Bundle was not resolved because of a uses constraint violation. > org.apache.felix.resolver.reason.ReasonException: Uses constraint > violation. Unable to resolve resource org.ops4j.pax.web.pax-web-runtime > [osgi.identity; osgi.identity="org.ops4j.pax.web.pax-web-runtime"; > type="osgi.bundle"; version:Version="9.0.15"] > because it is exposed to package > 'org.osgi.service.http.context' from resources > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] and > org.ops4j.pax.web.pax-web-api [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-api"; type="osgi.bundle"; > version:Version="9.0.15"] via two dependency chains. > > Chain 1: > org.ops4j.pax.web.pax-web-runtime [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-runtime"; type="osgi.bundle"; > version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.osgi.service.http.context)(&(version>=1.1.0)(!(version>=2.0.0)))) > | > export: osgi.wiring.package: org.osgi.service.http.context > org.osgi.service.http.whiteboard [osgi.identity; > osgi.identity="org.osgi.service.http.whiteboard"; type="osgi.bundle"; > version:Version="1.1.1.202109301733"] > > Chain 2: > org.ops4j.pax.web.pax-web-runtime [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-runtime"; type="osgi.bundle"; > version:Version="9.0.15"] > import: > (&(osgi.wiring.package=org.ops4j.pax.web.service.whiteboard)(version>=9.0.15)) > | > export: osgi.wiring.package: org.ops4j.pax.web.service.whiteboard; > uses:=org.osgi.service.http.context > export: osgi.wiring.package=org.osgi.service.http.context > org.ops4j.pax.web.pax-web-api [osgi.identity; > osgi.identity="org.ops4j.pax.web.pax-web-api"; type="osgi.bundle"; > version:Version="9.0.15"] > > Any help or insight would be very welcome as I'm at a loss here. > > Thanks > Alain > > -- > -- > ------------------ > OPS4J - http://www.ops4j.org - [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "OPS4J" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ops4j/dc06df7a-d5a9-47fa-8416-d2799a6ac411n%40googlegroups.com > <https://groups.google.com/d/msgid/ops4j/dc06df7a-d5a9-47fa-8416-d2799a6ac411n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/CAAdXmhptbeJSHb5anLpY13VB2FdVKeSkegGSHOF3J%2Btk%3DBQsdw%40mail.gmail.com.
