Hey guys,
I hope you can help. Following scenario, description below:
JPAServiceLocal.java:
@Local
public interface JPAServiceLocal
{
...
}
WebServiceBean.java:
@Stateless
public class WebServiceBean
{
@EJB
JPAServiceLocal jpa; //this Dependency Injection WORKS, I can work with the jpa object
...
public void serviceMethod1(){
jpa.method(); //WORKS
ControllerBean controller = new ControllerBean();
controller.doSomething();
}
ControllerBean.java:
@Stateless
public class ControllerBean
@EJB
JPAServiceLocal jpa; //this Dependency Injection DOES NOT WORK
public void doSomething(){
jpa.method(); //*NullPointerException*
}
The (stateless) Session Bean
WebServiceBean uses another (stateless) Session Bean
ControllerBean as a helper class. Dependency Injection works for the first, but not for the second bean. But why? The ControllerBean is not a POJO, it runs within the same EAR and therefore JVM, so all requirements are fulfilled, right?!
My ejb-jar.xml is empty, do I have to put something in there?
My application server is SAP NetWeaver 7.11.
Thanks for any hint, do I understand something wrong?
Cheers
Tim