[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Is adding your ejb's to the web.xml or other ejb references to ejb-jar.xml files important, if so why?

I'm developing a J2EE web application using Struts, and EJB's.

My question is that I have not included any ejb references in my web.xml file that any of my war classes are using, nor did I enter any references in my session ejb's xml file who reference various CMP beans.  Am I losing anything by not doing this, as the application works fine omitting these references.  

I'm using XDoclet tags and never bothered using the references.  I don't know what the benefits are as of right now to me it seems adding them in just adds more maintenace work.

FYI in my dev environment I have an exploded war file and an ear file that contains all my ejb's and related classes.

In my test env, I have one ear file and all works fine.

1 Solution
If you are using xdoclets then you are not loosing anything.
The concept of defining reference for EJB in the EJB xml descriptor or servlets web.xml is to enable you to code against
a logical binding name (instead of using the real jndi path). That concept was suppose to diffrenciate between developers and j2ee
assembler which was suppose to take all the pieces and connect them together. That concept was never really used because most of the
developers are the assemblers (connecting the j2ee elements together). Also in your case you can have xdoclets generate such reference, but
then what is the point if the ejb jndi name change you are going to change your xdoclet code (and hence your code) anyway.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now