Skip to content

OSGi bundles have constraint violations when client and server are used in the same OSGi environment #3

@ikannak

Description

@ikannak

We want to upgrade from the old xmlrpc 3.1.3 bundles that are no longer updated to your fork of the project.

We have an product with server/agent/frontend architecture where a single OSGi environment needs to have both server and client functionality of XMLRPC and as such requires both client and server packages. When we updated our dependency tree to use version 4.0.0 of your product, we got this error:

INFO   | jvm 1    | 2025/05/09 15:51:33 | org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0] because it is exposed to package 'org.apache.xmlrpc' from resources com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server/4.0.0] and com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client/4.0.0] via two dependency chains.
INFO   | jvm 1    | 2025/05/09 15:51:33 | 
INFO   | jvm 1    | 2025/05/09 15:51:33 | Chain 1:
INFO   | jvm 1    | 2025/05/09 15:51:33 |   be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 |     import: (&(osgi.wiring.package=org.apache.xmlrpc)(version>=4.0.0)(!(version>=5.0.0)))
INFO   | jvm 1    | 2025/05/09 15:51:33 |      |
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package: org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |   com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server/4.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 | 
INFO   | jvm 1    | 2025/05/09 15:51:33 | Chain 2:
INFO   | jvm 1    | 2025/05/09 15:51:33 |   be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 |     import: (&(osgi.wiring.package=org.apache.xmlrpc.client)(version>=4.0.0)(!(version>=5.0.0)))
INFO   | jvm 1    | 2025/05/09 15:51:33 |      |
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package: org.apache.xmlrpc.client; uses:=org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package=org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |   com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client/4.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl$UseConstraintError.toException(ResolverImpl.java:2471)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:420)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:401)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1063)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.lang.Thread.run(Thread.java:829)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 2025-05-09 15:51:33,183 [FelixStartLevel] ERROR BootFeaturesInstaller | 13 - org.apache.karaf.features.core - 4.2.15 | Error installing boot features
INFO   | jvm 1    | 2025/05/09 15:51:33 | org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0] because it is exposed to package 'org.apache.xmlrpc' from resources com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server/4.0.0] and com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client/4.0.0] via two dependency chains.
INFO   | jvm 1    | 2025/05/09 15:51:33 | 
INFO   | jvm 1    | 2025/05/09 15:51:33 | Chain 1:
INFO   | jvm 1    | 2025/05/09 15:51:33 |   be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 |     import: (&(osgi.wiring.package=org.apache.xmlrpc)(version>=4.0.0)(!(version>=5.0.0)))
INFO   | jvm 1    | 2025/05/09 15:51:33 |      |
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package: org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |   com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-server/4.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 | 
INFO   | jvm 1    | 2025/05/09 15:51:33 | Chain 2:
INFO   | jvm 1    | 2025/05/09 15:51:33 |   be.ikan.lib.util.xmlrpc [be.ikan.lib.util.xmlrpc/7.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 |     import: (&(osgi.wiring.package=org.apache.xmlrpc.client)(version>=4.0.0)(!(version>=5.0.0)))
INFO   | jvm 1    | 2025/05/09 15:51:33 |      |
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package: org.apache.xmlrpc.client; uses:=org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |     export: osgi.wiring.package=org.apache.xmlrpc
INFO   | jvm 1    | 2025/05/09 15:51:33 |   com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client [com.evolvedbinary.thirdparty.org.apache.xmlrpc.xmlrpc-client/4.0.0]
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl$UseConstraintError.toException(ResolverImpl.java:2471)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:420)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:401)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1063)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
INFO   | jvm 1    | 2025/05/09 15:51:33 | 	at java.base/java.lang.Thread.run(Thread.java:829)

When looking at your 4.0.0 bundle contents and comparing them to the old XMLRPC 3.1.3 bundles, this is how they compare. First the old 3.1.3 bundles:

Image

then your 4.0.0 bundles:

Image

In an OSGi environment, there should not be any shared packages and/or classes between bundles. This is precisely why there are separate client, common and server bundles that can be used separately or as a whole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions