File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes @EJB injection to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@EJB injection to servlet" Watch "@EJB injection to servlet" New topic

@EJB injection to servlet

Krzysztof Miarecki

Joined: Nov 26, 2009
Posts: 6
Lets assume, that we have a servlet with dependency injected ejb into instance field:

Servlet and EJB run on different JVMs (and different machines).
How it works?
1. Injected ejb remains the same object per servlet lifetime or it works as a service locator every time servlet wants something from ejb?
2. What if the injected ejb should be destroyed because of some exception - container injects new ejb automatically?
I agree. Here's the link:
subject: @EJB injection to servlet
It's not a secret anymore!