Skip to main content
Level 2
Jun 6, 2017 7:02 AM UTC
Solved

OSGI srvice is not getting registered

Hi,

I am facing an issue i created a project of maven archType10 in eclipse and when i upload the bundle on felix console it does not show the service registered over there below is the code what i wrote and screenshot of the bundle on felix,

MyService.java (Interface)

package com.aem.community.core.services;

public interface MyService {

  public String helloWorld();

}

MyServiceImpl.java (class implementing Interface)

package com.aem.community.core.servicesImpl;

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

import com.aem.community.core.services.MyService;

import aQute.bnd.annotation.component.Component;

@Component(immediate=true)

@Service(value=MyService.class)

public class MyServiceImpl implements MyService {

  @Override

  public String helloWorld() {

  return ("Hello");

  }

}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
shubham250894Accepted solution
Level 2
Jun 7, 2017 10:57 AM UTC

I made the blunder there is issue with the highlighted import i changed it to

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

and it works fine. Thanks for the help everyone

24 replies

Level 2
Jun 7, 2017 6:24 AM UTC

Hi Veena,

I got this in error log. Red marked logs says it is registered.

in error log i cannot find my service at all

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Jun 7, 2017 6:33 AM UTC

Taking a step back, what exactly is the errormessage?

You posted a screenshot, but I can't see the errormessage there.

Translate
Level 2
Jun 7, 2017 6:39 AM UTC

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Jun 7, 2017 6:47 AM UTC

thanks for this.

Can you confirm in your code, that indeed the service null. Thus causing the NPE.

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Jun 7, 2017 6:50 AM UTC

Also check in /system/console/components and see for more info there.

Translate
Level 2
Jun 7, 2017 6:50 AM UTC

yeah the service is null

Translate
Level 2
Jun 7, 2017 6:55 AM UTC

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Jun 7, 2017 10:43 AM UTC

What do you see when you open the details?

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Jun 7, 2017 10:44 AM UTC

Also I don't see "MyServiceImpl" in this list.

Translate
Level 2
Jun 7, 2017 10:52 AM UTC

Yes there is no MyServiceImpl but Why ?

Translate