You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "Jan J. Roman" <po...@jjroman.net> on 2015/04/05 18:21:23 UTC
Problem using standard osgi annotation with felix scr
Hello,
I am trying to create simple service using standard declarative services
annotations. (org.osgi.service.component.annotations.*)
I found two problem which I think may be related to problem recently
reported here [1].
Firstly if I did not specify service name in @Component annotation, build
fails with following error(it is the same if name is set to default value
explicitly):
[ERROR] Bundle example:exampleDS:bundle:1.0-SNAPSHOT : Service-Component
entry can not be located in JAR: OSGI-INF/example.SampleComparator.xml~
[ERROR] Error(s) found in bundle configuration
If I change the name for instance to be "test" then build succeed but I am
getting error while trying to start the bundle
g! start 118
[Gogo shell] DEBUG exampleDS - BundleEvent STARTING - exampleDS
[Gogo shell] DEBUG exampleDS - BundleEvent STARTED - exampleDS
[Gogo shell] ERROR exampleDS - [test] Cannot register Component
org.osgi.service.component.ComponentException: The component name 'test'
has alr
eady been registered by Bundle 118 (exampleDS) as Component of Class
example.Sam
pleComparator
at
org.apache.felix.scr.impl.ComponentRegistry.checkComponentName(Compon
entRegistry.java:370)
....
Service starts anyway as I can execute exported console commands.
I looked into generated jar file it appears that there are two xml service
descriptors: "test.xml" and "example.SampleComparator.xml"
Please find attached buildable project (only short pom file and
SampleComparator.java)
Is it known problem? Should felix scr work correctly with standard osgi
annotations?
[1] https://issues.apache.org/jira/browse/FELIX-4836,
http://www.mail-archive.com/users%40felix.apache.org/msg16212.html
Regards
Jan Roman