Timo E aus E created KARAF-6474:
-----------------------------------

             Summary: Reference binding with target filter does not work
                 Key: KARAF-6474
                 URL: https://issues.apache.org/jira/browse/KARAF-6474
             Project: Karaf
          Issue Type: Question
          Components: karaf
    Affects Versions: 4.2.6, 4.1.7
            Reporter: Timo E aus E


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
{code}
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))"]]
{code} 

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to