Originally posted by Anthony Watson:
I know that using the ejb-ref element in the web.xml file will ensure that the ejb is available when the web application is deployed. Is there any other reason to use the ejb-ref element? Does its usage have any impact on somehow notifying your web application if the ejb jar is redeployed?
The ejb-ref actually declares a "logical name" for an EJB for use within your webapp. So, say the real JNDI name for my EJB is "ejb/AbcBean", but I refer to it in my webapp as "ejb/XyzBean", that's okay. The deployer (typically us unlucky developers) has to map those logical references to physical or actual references at deployment time. This level of indirection/abstraction allows us to piece together J2EE components more easily.