The @EJB annotation can be used in "managed clients" to access the EJB.
You can put this annotation in a servlet class by declaring a member variable.
public class MyServlet extends HttpServlet {
@EJB
private MyWorkerInterface theWorker;
}
This @EJB annotation has been extended to JNDI requests that (I assume) are executed when servlet is initialized. These JNDI requests may fail: the EJB provider can modify its annotations to specify specific JNDI names, then a different JNDI name must be specified for the @EJB link, or the search will fail.
Also, I think, since EJB can be remote, there is the possibility of transients, network failures and server errors.
My thought: when using theWorker I have to check its authenticity.
if ( theWorker == null ) {
My questions:
1.) ?
2.) , , , ? . , ? ?
3.) : , , JNDI- , @EJB. ?