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

cannot find symbol @Activate Error in OSGI class compilation

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

I am trying to write an OSGI class which should populate the configuration dialog in Felix console, my Service implementation as shown below. but when i try to run mvn clean install -PautoInstallPackage am getting the below error. any help is appreciated.

 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project osgiexample.core: Compilation failure [ERROR] /E://osgiexample/core/src/main/java/osgiexample/core/serviceimpl/TestServiceImpl.java:[40,10] cannot find symbol [ERROR] symbol: class Activate [ERROR] location: class osgiexample.core.serviceimpl.TestServiceImpl

 

My Code snippet is as below

@Component(immediate=true, label="TEST Service", description="Hello There - This is a Service component", metatype=true) @Service(value=TestService.class) public class TestServiceImpl implements TestService { @Property(value="http://testservice/myservice?wsdl") static final String SERVICE_ENDPOINT_URL = "service.endpoint.url"; private String serviceEndpointUrl; @Override public String getData() { // TODO Auto-generated method stub return null; } @Activate public void activate(final Map<String, Object> props) { System.out.println("Calling Activate Method"); this.serviceEndpointUrl = (String)props.get(SERVICE_ENDPOINT_URL); System.out.println("ServiceEndpointUrl:" + this.serviceEndpointUrl); } }

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 10
Level 4
Var
Level 4

Likes

44 likes

Total Posts

113 posts

Correct Reply

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

Avatar
Validate 10
Level 4
Var
Level 4

Likes

44 likes

Total Posts

113 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile
Var
Level 4

08-03-2017

Is your class has the below import .?

import org.apache.felix.scr.annotations.Activate;

 

~VAr

Answers (3)

Answers (3)

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

Var wrote...

Is your class has the below import .?

  1. import org.apache.felix.scr.annotations.Activate;

 

~VAr

 

Thanks VAr, i realized that i have missed the import of this annotation, after adding it compiled successfully.

Kk

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

smacdonald2008 wrote...

Build your project via maven Archetype 10 and use Urber Jar: http://scottsdigitalcommunity.blogspot.ca/2016/04/creating-your-first-aem-62-project.html?m=0

 

 

Thanks Scott, i am using Archetype 10 only.

Kk

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

08-03-2017

Build your project via maven Archetype 10 and use Urber Jar: http://scottsdigitalcommunity.blogspot.ca/2016/04/creating-your-first-aem-62-project.html?m=0