[
https://issues.apache.org/jira/browse/KARAF-6474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16956833#comment-16956833
]
Jean-Baptiste Onofré commented on KARAF-6474:
---------------------------------------------
The problem is not about the reference at runtime. The problem is about the
capability and the resolver.
Can you please check that your bundle provide the service capability in the
bundle (it should be done automatically by the maven-bundle-plugin if you use
maven-bundle-plugin 4.x) ?
If your bundle doesn't contain the capability, you can also create the
capability on the feature like this:
{code}
<feature ...>
<capability>
osgi.service;objectClass=karafplayground.interface1.ResponderService;effective:=active;type=world
</capability>
</feature>
{code}
> 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.1.7, 4.2.6
> Reporter: Timo E aus E
> Assignee: Jean-Baptiste Onofré
> Priority: Major
>
> 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)