ServiceManager.getService for ProjectService creation gives null value


I have written a ProjectService class as below:

public static class ProjectService {
private HorBugTable bugsTable;

public HorBugTable getHoBugTable() {
return bugsTable;

void setHorBugTable(HorBugTable bugsTable) {
this.bugsTable = bugsTable;

I registered the class in XML the following way:

<extensions defaultExtensionNs="com.intellij">
<toolWindow id="Video" secondary="false" icon="/icons/video6x16.svg" anchor="bottom"

<projectService serviceInterface="factory.DebuggerFactory.ProjectService"
serviceImplementation="factory.DebuggerFactory.ProjectService" />

I get a null pointer exception when I instantiate this class with the following (I also see getService is depreciated but ComponentManager.getServices() shows compile error.) What am I doing wrong?

ProjectService projectService =  ServiceManager.getService(project, ProjectService.class);
1 comment


Why do you have the static modifier in your class header? It seems that you have a nested class, and you reference it wrongly in the plugin.xml file. It should be done with dollar character:

<projectService serviceImplementation="factory.DebuggerFactory$ProjectService"/>


  1. A more convenient way of getting project service is simple: project.getService(ProjectService.class).
  2. You don't need the serviceInterface attribute as you don't have any interface.

Please sign in to leave a comment.