osgi service calling another service fails to load at runtime.

Avatar

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile
TB3dock
Level 4

18-07-2021

we have a servlet which calls our service, which calls another service, which calls the original service. This compiles, but when we deploy locally, we get 404 for the servlet page. If we comment out the service, the servlet gets called.  Does this mean we cannot have services calling each other?  Not sure how to structure the code without this.

 

GetSomething.java

 

@Slf4j
@Component(service = { Servlet.class })
@SlingServletPaths(value="/bin/myservlet")
public class GetSomething {

	@Reference
	private AService aService;

 

 

AService.java

 

@component(service = AService.class)
public class AServiceImpl implements AService {

	@Reference
	private BService bService;

 

BService.java

@component(service = BService.class)
public class BServiceImpl implements BService {

	@Reference
	private AService aService;

 The above code wont work, even if no methods are called in any of the services - the servlet doesnt exist after deployment.  If we comment out the reference to AService in BService, then the servlet exists on the server.

 

Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile
TB3dock
Level 4

18-07-2021

Answers (0)