Issue getting legacy driver to run as OSGI bundle

I am trying to upgrade a project and use the MongoDB legacy driver 4.3.2. After all sorts of pom changes to try to get feature to run, decided to create a shaded artifact that contains mongodb-driver-legacy, bson, mongodb-driver-core and mongodb-driver-sync as the last 3 are compile dependencies for mongodb-driver-legacy. I am consistently running into the issue “filter:=”(osgi.wiring.package=javax.annotation.meta" and cannot get past this. Any advice would be greatly appreciated.

Hi @Steve_Faingold

We did fix a bug in 4.3.2 release to OSGi (missing package import), but since you’re using 4.3.2 you should already have the fix for it. Are you getting an error when you try to use a the artifacts that we provide? If so, can you post it?

Have you asked this question in any forums where more OSGi folks hang out? The error you’re getting seems on the face of it unrelated to the Java driver.

Regards,
Jeff

Jeff thanks for the fast reply.

The dependencies in the shaded pom are below. I should mention that the application compiles with only the legacy jar, but the other 3 dependencies seem like they are required when running the OSGI bundle.

org.mongodb mongodb-driver-legacy 4.3.2 org.mongodb bson 4.3.2 compile org.mongodb mongodb-driver-core 4.3.2 compile org.mongodb mongodb-driver-sync 4.3.2 compile

The error is

org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=xxx-feature; type=karaf.feature; version="[0.0.0.__osgi_bundle_version_,0.0.0.__osgi_bundle_version_]"; filter:="(&(osgi.identity=xxx-feature)(type=karaf.feature)(version>=0.0.0.__osgi_bundle_version_)(version<=0.0.0.__osgi_bundle_version_))" [caused by: Unable to resolve xxx-feature/0.0.0.__osgi_bundle_version_: missing requirement [xxx-feature/0.0.0.__osgi_bundle_version_] osgi.identity; osgi.identity=xxx-core-feature; type=karaf.feature; version="[5.300.0.SNAPSHOT,5.300.0.SNAPSHOT]" [caused by: Unable to resolve xxx-core-feature/5.300.0.SNAPSHOT: missing requirement [xxx-core-feature/5.300.0.SNAPSHOT] osgi.identity; osgi.identity=xxx-web-common; type=karaf.feature; version="[5.300.0.SNAPSHOT,5.300.0.SNAPSHOT]" [caused by: Unable to resolve xxx-web-common/5.300.0.SNAPSHOT: missing requirement [xxx-web-common/5.300.0.SNAPSHOT] osgi.identity; osgi.identity=xxx-service-aggregation; type=karaf.feature; version="[5.300.0.SNAPSHOT,5.300.0.SNAPSHOT]" [caused by: Unable to resolve xxx-service-aggregation/5.300.0.SNAPSHOT: missing requirement [xxx-service-aggregation/5.300.0.SNAPSHOT] osgi.identity; osgi.identity=com.cme.xxx.xxx-shade-mongodb; type=osgi.bundle; version="[5.300.0.202109241513,5.300.0.202109241513]"; resolution:=mandatory [caused by: Unable to resolve com.cme.xxx.xxx-shade-mongodb/5.300.0.202109241513: missing requirement [com.cme.xxx.xxx-shade-mongodb/5.300.0.202109241513] osgi.wiring.package; filter:="(osgi.wiring.package=javax.annotation.meta)"]]]]]
    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:218) ~[?:?]
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:285) ~[?:?]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1170) ~[?:?]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1069) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]