osgi service calling another service fails to load at runtime. | Community
Skip to main content
Level 8
July 18, 2021
Solved

osgi service calling another service fails to load at runtime.

  • July 18, 2021
  • 1 reply
  • 905 views

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

 

@8220494(service = AService.class) public class AServiceImpl implements AService { @Reference private BService bService;

 

BService.java

@8220494(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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

TB3dockAuthorAccepted solution
Level 8
July 18, 2021