I have a class with annotation @Service :
@Service
public class NeoEntityService {
@Override
public List<NeoEntity> getRenamedEntitiesForUser(DirectoryUser user, String siloId) throws OxwayException {
List<NeoEntity> entities = new ArrayList<NeoEntity>();
return entities;
}
}
I want to use this service in another class like this :
@Service("briefcaseService")
public class BriefcaseService {
@Resource
private NeoEntityService neoEntityService;
public void test(DirectoryUser user, String siloId) {
try {
System.out.println(neoEntityService.getRenamedEntitiesForUser(user, siloId).size());
} catch (OxwayException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
When I start my server and try to use my BriefcaseService i have this error :
javax.servlet.ServletException: Error injecting resources into managed bean 'BriefcaseService'
And also this one :
java.lang.NullPointerException
com.ixxo.wms.iface.jsf.pages.briefcase.views.BriefcaseService.test(BriefcaseService.java:9)
I've tried a lot of things, including adding @Service("neoEntityService") in my class NeoEntityService but it still doesn't work. It seems like BriefcaseService is not able to get NeoEntityService so it's null when I am using it in BriefcaseService.
Any idea?
Thanks
EDIT : I ran this code on my colleague's PC and it works on his computer. Any idea why and how? It's probably not an error of annotation or anything, just an environment problem I guess.