-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
None
While working on c/68767 to use of the new Web API in project Neutron, I bumped into a very confusing issue which I finally was able to work around (in Patch Set 5 of c/68767), but that is worth recording here in case anyone else wants to further investigate this separately some later time, and a record just in case we run into this same issue again later when using the Web API in other projects:
It seems that the use of the @OsgiService annotation from pax-cdi-api which is useful to avoid having to manually write a BP XML with a <reference> (as documented on https://wiki.opendaylight.org/view/BestPractices/DI_Guidelines#NEW:_.40OsgiService_.26_.40OsgiServiceProvider_.28pax-cdi-api.29), does not work IFF said service is registered programmatically via an OSGi Service Factory, such as the org.opendaylight.aaa.web.WebServer was in https://git.opendaylight.org/gerrit/#/c/69475/. I have used this for other "normal" OSGi Services advertised via an @OsgiServiceProvider annotation in several places (notably infrautils but I think also some in genius and netvirt), where it did work. The link with the OSGi Service Factory based registration is more of a suspicions than something I have conclusively proven.
This seems to have something to do with this Import that gets generated in the MANIFEST.MF (of org.opendaylight.neutron.northbound-api in this case, but it's probably got nothing to do with Neutron):
Import-Service: org.opendaylight.aaa.web.WebServer;multiple:=false
Here is the full SFT failure details:
[INFO] --- maven-surefire-plugin:2.18.1:test (default) @ odl-neutron-northbound-api --- [INFO] Surefire report directory: /home/vorburger/dev/ODL/git/neutron/features/production/odl-neutron-northbound-api/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.opendaylight.odlparent.featuretest.SingleFeatureTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 22.34 sec <<< FAILURE! - in org.opendaylight.odlparent.featuretest.SingleFeatureTest installFeatureCatchAndLog(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/vorburger/dev/ODL/git/neutron/features/production/odl-neutron-northbound-api/target/feature/feature.xml, Feature: odl-neutron-northbound-api 0.11.0.SNAPSHOT] Time elapsed: 21.386 sec <<< ERROR! org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=odl-neutron-northbound-api; type=karaf.feature; version="[0.11.0.SNAPSHOT,0.11.0.SNAPSHOT]"; filter:="(&(osgi.identity=odl-neutron-northbound-api)(type=karaf.feature)(version>=0.11.0.SNAPSHOT)(version<=0.11.0.SNAPSHOT))" [caused by: Unable to resolve odl-neutron-northbound-api/0.11.0.SNAPSHOT: missing requirement [odl-neutron-northbound-api/0.11.0.SNAPSHOT] osgi.identity; osgi.identity=org.opendaylight.neutron.northbound-api; type=osgi.bundle; version="[0.11.0.SNAPSHOT,0.11.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve org.opendaylight.neutron.northbound-api/0.11.0.SNAPSHOT: missing requirement [org.opendaylight.neutron.northbound-api/0.11.0.SNAPSHOT] osgi.service; effective:=active; filter:="(objectClass=org.opendaylight.aaa.web.WebServer)"]] at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42) at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391) at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377) at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:349) at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:218) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:291) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1248) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$1(FeaturesServiceImpl.java:1147) 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) Results : Tests in error: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=odl-neutron-northbound-api; type=karaf.feature; version="[0.11.0.SNAPSHOT,0.11.0.SNAPSHOT]"; filter:="(&(osgi.identity=odl-neutron-northbound-api)(type=karaf.feature)(version>=0.11.0.SNAPSHOT)(version<=0.11.0.SNAPSHOT))" [caused by: Unable to resolve odl-neutron-northbound-api/0.11.0.SNAPSHOT: missing requirement [odl-neutron-northbound-api/0.11.0.SNAPSHOT] osgi.identity; osgi.identity=org.opendaylight.neutron.northbound-api; type=osgi.bundle; version="[0.11.0.SNAPSHOT,0.11.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve org.opendaylight.neutron.northbound-api/0.11.0.SNAPSHOT: missing requirement [org.opendaylight.neutron.northbound-api/0.11.0.SNAPSHOT] osgi.service; effective:=active; filter:="(objectClass=org.opendaylight.aaa.web.WebServer)"]] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] ODL :: neutron :: project-neutron-parent ........... SUCCESS [ 5.379 s] [INFO] ODL :: neutron :: model ............................ SUCCESS [ 30.068 s] [INFO] ODL :: neutron :: neutron-spi ...................... SUCCESS [ 14.721 s] [INFO] ODL :: neutron :: northbound-api ................... SUCCESS [ 16.400 s] [INFO] ODL :: neutron :: transcriber ...................... SUCCESS [ 11.843 s] [INFO] ODL :: neutron :: neutron-logger ................... SUCCESS [ 3.693 s] [INFO] Neutron Artifacts .................................. SUCCESS [ 0.252 s] [INFO] OpenDaylight :: Neutron :: API ..................... SUCCESS [ 31.421 s] [INFO] OpenDaylight :: Neutron :: Northbound .............. FAILURE [ 29.459 s] [INFO] OpenDaylight :: Neutron :: Service ................. SKIPPED [INFO] ODL :: neutron :: neutron-hostconfig-utils ......... SKIPPED [INFO] ODL :: neutron :: neutron-hostconfig-ovs ........... SKIPPED [INFO] OpenDaylight :: Neutron :: Hostconfig :: OVS ....... SKIPPED [INFO] ODL :: neutron :: neutron-hostconfig-vpp ........... SKIPPED [INFO] OpenDaylight :: Neutron :: Hostconfig :: VPP ....... SKIPPED [INFO] features-neutron-service ........................... SKIPPED [INFO] OpenDaylight :: Neutron :: Logger .................. SKIPPED [INFO] features-aggregator ................................ SKIPPED [INFO] ODL :: neutron :: integration-test-standalone ...... SKIPPED [INFO] OpenDaylight :: Neutron :: Logger :: Test .......... SKIPPED [INFO] features-neutron-test .............................. SKIPPED [INFO] features-test-aggregator ........................... SKIPPED [INFO] neutron-karaf ...................................... SKIPPED [INFO] ODL :: neutron :: integration-test ................. SKIPPED [INFO] ODL :: neutron :: neutron-hostconfig ............... SKIPPED [INFO] neutron ............................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:27 min [INFO] Finished at: 2018-03-16T00:25:38+01:00 [INFO] Final Memory: 199M/1836M [INFO] ------------------------------------------------------------------------