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

Posted on 2005-04-07
Last Modified: 2013-11-24
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.

Question by:phoenixsilver
    1 Comment
    LVL 15

    Accepted 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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    countX 22 48
    wordcount challenge 11 42
    wordappend challenge 8 42
    java  and programming certification ? 4 21
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    The viewer will learn how to implement Singleton Design Pattern in Java.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now