Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
up vote 0 down vote accepted

You're essentially correct, note that with EJB 3.1, you can have light-weight EJBS that run in your web (servlet) container. Also the JNDI lookup can now be defined as a standard global lookup, so if you migrate to another app server your code doesn't have to change.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.