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

SOLVED

osgi service calling another service fails to load at runtime.

TB3dock
Level 7
Level 7

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?

1 Accepted Solution
TB3dock
Correct answer by
Level 7
Level 7
1 Reply
TB3dock
Correct answer by
Level 7
Level 7