Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

@Reference(“(service.label=TESTCALL)”) Felix SCR annotation error

Avatar

Avatar
Validate 25
Level 4
Kkkrish
Level 4

Likes

27 likes

Total Posts

107 posts

Correct Reply

1 solution
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
Kkkrish
Level 4

Likes

27 likes

Total Posts

107 posts

Correct Reply

1 solution
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Kkkrish
Level 4

08-03-2017

am trying to implement an OSGI service which can serve me as ConfigurationFactory the service implementation has just two properties as shown below.

@Property(value="this is service variable property value") static final String MY_SERVICE_VARIABLE = "service.variable"; @Property(description="Label for this MyService") private static final String MY_SERVICE_LABEL = "service.label";

and am retrieving this service configuration data from an OSGI servlet where i am trying to call this service by below code which compiles fine and retrieves data randomly from the multiple service configuration.

@Reference MyService myservice;


But when i wanted to get each configuration data by using the service.label and am calling the service by using below code snippet in my OSGI servlet, while compiling am facing the below Error.

@Reference("(service.label=TESTCALL)") MyService myservice;


cannot find symbol [ERROR] symbol: method value() [ERROR] location: @interface org.apache.felix.scr.annotations.Reference.

View Entire Topic

Avatar

Avatar
Validate 25
Level 4
Kkkrish
Level 4

Likes

27 likes

Total Posts

107 posts

Correct Reply

1 solution
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
Kkkrish
Level 4

Likes

27 likes

Total Posts

107 posts

Correct Reply

1 solution
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Kkkrish
Level 4

09-03-2017

Feike Visser wrote...

Why are you not setting these properties on the @Component annotation?

 

Hi Feike Visser,

  1. @Reference("(service.label=TESTCALL)")
  2. MyService myservice;

This above code snippet i am using in a servlet where i need to create a service reference that is being used to call for retrieving configuration data from OSGI FELIX Factory console, am referring https://cqdump.wordpress.com/2014/08/05/managing-multiple-instances-of-services-osgi-service-factori... this article to create multiple instances of services via OSGI Service Factory. where as with above code its giving compilation error. and without any parameter to @Reference annotation it is compiled.

Is there any way that can help me in achieving  " how to retrieve OSGI multi services data from Service factory " ?

 

Kk