Hello,
I am using OpenEJB 3.1 in Tomcat.
I use the Annotation @EJB in my Servlet in order to obtain my EJB and it
works well.
But If I use the Annotation @EJB in an abstract Servlet (which is the
superclass of all my Servlets), it does'nt work : it seams that the EJB
Annotation is not "interpreted" by openEJB.
Is this normal ? Is there any way for referencing EJB in abstract Servlet ?
Thanks in advance,
Maxime
Example :
public abstract class AbstractTestServlet extends HttpServlet {
@EJB
protected MyEJB myEJB;
protected void testEJB() {
myEJB.test();
}
}
public class TestServlet extends AbstractTestServlet {
@EJB
protected MyEJB myEJB2;
...
protected void testMyEJB() {
myEJB2.test(); // this works
testEJB(); // this doesn't work : NPE
myEJB.test(); // this doesn't work : NPE (myEJB is null)
}
}
--
View this message in context:
http://www.nabble.com/EJB-Annotation-does-not-work-in-AbstractServlet-tp21087942p21087942.html
Sent from the OpenEJB User mailing list archive at Nabble.com.