Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-6474

Reference binding with target filter does not work

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Resolved
    • Priority: Major
    • Resolution: Resolved
    • Affects Version/s: 4.1.7, 4.2.6
    • Fix Version/s: None
    • Component/s: karaf
    • Labels:
      None

      Description

      Hello,

      I face a problem when trying to reference a SCR Component by another SCR Component. My setup is:

      • There is an interface and its implementation, being provided by two OSGi bundles.
      • Two configuration files initiate two instances of the implementation.
      • Two consumers reference the interface, using the target¬†property of the @Reference annotation.

      Codebase is here: https://github.com/timoe/karaf-4-playground. It can be build and started by mvn clean install && assembly/target/assembly/bin/karaf clean.

      I set this up via features. Feature-1 contains the interface and its implementation. Feature-2 contains both consumers. Feature-1 is a boot feature, Feature-2 is just installed. When Feature-2 is installed I get

      karaf@root()> feature:install playground-feature-2
      Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=playground-feature-2; type=karaf.feature; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; filter:="(&(osgi.identity=playground-feature-2)(type=karaf.feature)(version>=0.0.1.SNAPSHOT)(version<=0.0.1.SNAPSHOT))" [caused by: Unable to resolve playground-feature-2/0.0.1.SNAPSHOT: missing requirement [playground-feature-2/0.0.1.SNAPSHOT] osgi.identity; osgi.identity=karaf4-playground.playground-api-consumer-1; type=osgi.bundle; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve karaf4-playground.playground-api-consumer-1/0.0.1.SNAPSHOT: missing requirement [karaf4-playground.playground-api-consumer-1/0.0.1.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=karafplayground.interface1.ResponderService)(type=world))"]]
      

      I played around with Felix SCR annotation as well, result is the same.

      One strange thing is: When I install bundles from Feature-2 separately bundle:install mvn:karaf4-playground/playground-api-consumer-1/0.0.1-SNAPSHOT, bundle:install mvn:karaf4-playground/playground-api-consumer-2/0.0.1-SNAPSHOT and start them afterwards, they appear.

      Can you help me out with that?

      Thanks
      – Timo

        Attachments

          Activity

            People

            • Assignee:
              jbonofre Jean-Baptiste Onofré
              Reporter:
              timo.e.aus.e Timo E aus E
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: