This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Similar Threads
Using JNDI lookup to get access to the EJB
why resource injection is not allowed in web client for EJB 3.0?
@EJB annotation from a servlet