EJB Lifecycle and Relation to WARs
- by Adam Tannon
I've been reading up on EJBs (3.x) and believe I understand the basics. This question is a "call for confirmation" that I have interpreted the Java EE docs correctly and that I understand these fundamental concepts:
An EJB is to an App Container as a Web App (WAR) is to a Web Container
Just like you deploy a WAR to a Web Container, and that container manages your WAR's life cycle, you deploy an EJB to an App Container, and the container manages your EJB's life cycle
When the App Container fires up and deploys an EJB, it is given a unique "identifier" and URL that can be used by JNDI to look up the EJB from another tier (like the web tier)
So, when your web app wants to invoke one of your EJB's methods, it looks the EJB up using some kind of service locator (JNDI) and invoke the method that way
Am I on-track or way off-base here? Please correct me & clarify for me if any of these are incorrect. Thanks in advance!