This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I regularly wonder about the correct meaning of the phrase "EJB Container" in conjunction with "ENC".
Does it mean "Application Server" or does it mean "deployed EJB-Jar" in this context?
Or even something completely different?
A quote from O'Reillys "EJB 3.0", intro of chapter 14:
"Every EJB container that is deployed in an application server has it's own personal internal registry called Enterprise Naming Context (ENC) ..."
Do I have as much ENCs in my application server as EJB-Jars deployed?
And is this idea correct: The ENC contains private local contexts for each Enterprise Bean/Interceptor?
I will try to answer in my words. For me, a container is runtime environment that provides different services, in this case its security, transactions, and the like. Like Java, itself, but better. You write classes (EJB) that adhere to the contract specified in the specs, and the container (the runtime) also adheres to it so that you know what you can expect and what you can't. The container instantiates your classes, and manages their lifecycles, kind of like when Java manages your main class' lifecycle.
For ENC, every bean has its private environment, where you can add various settings (env-entries) and bind necessary objects (ques, topics, other beans...) that the bean may use. It is implemented in a form of a javax.naming.Context in Java EE.
As for the sentence you quoted, I don't fully understand it, looks like there is a mistake - the "container" word doesn't fit in.
Joined: Feb 08, 2009
Good point to examine a Java EE application from the perspective of contracting parties.
And glad to see the quote from "EJB 3.0" seems to be misleading or even a mistake actually.