I am trying to import and use Apache Kafka producer within an application of a much bigger project (onosproject.org) developed with Karaf. My application is referencing four services of which only one is satisfied, resulting in unsatisfied component:
onos> scr:list | grep com.foo.bar
115 | UNSATISFIED | com.foo.bar.AppComponent
After removing the code that required the three unsatisfied service I got the same behaviour which looks even stranger.
onos> scr:details com.foo.bar.AppComponent
Component Details
Name : com.foo.bar.AppComponent
State : UNSATISFIED
Properties :
service.pid=com.foo.bar.AppComponent
component.name=com.foo.bar.AppComponent
component.id=115
References
Reference : hostService
State : satisfied
Multiple : single
Optional : mandatory
Policy : static
Service Reference : Bound Service ID 1023 (org.onosproject.net.host.impl.HostManager)
Judging from logs, activation works fine which makes me believe that something in pom.xml
's dependencies is incorrect. I am building using servicemix:
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.kafka-clients</artifactId>
<version>0.8.2.2_1</version>
</dependency>
with maven-bundle-plugin:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>net.jpountz*;version="[1.2.0,1.3.0)";resolution:=optional,
javax.management*,
org.slf4j*;resolution:=optional,
org.xerial.snappy;resolution:=optional,
sun.misc;resolution:=optional,
sun.nio.ch;resolution:=optional
</Import-Package>
<Export-Package>
org.apache.kafka.*
</Export-Package>
</instructions>
</configuration>
</plugin>
I don't know if I have to, but I also exposing servicemix bundle via features.xml
:
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/0.8.2.2_1</bundle>
I have also tried building with org.apache.kafka/kafka-clients/0.8.2.2
instead the servicemix but I had the same behavior.
Please find a much more detailed description of my tries/logs in this github repo.
Any suggestions will be appreciated! :)