1 Reply Latest reply on Jul 3, 2002 7:10 PM by timfox

    Forgive my ignorance

    jdavies

      But something has been troubling me as I develop EJB's, not just in JBOSS, but for Weblogic also.

      I don't understand why the XML files need to contain an <ejb-ref> structure, especially in the web-client.xml file. Why can't the JSP clients simply load the EJB using the JNDI name (like I used to do all the time in Weblogic 5). Why must there be an XML file in the WAR file that hold an <ejb-ref>?

      I assume that there must be a very good reason, since both JBOSS and Weblogic (and I suspect WebSphere) have implemented this structure. I was just hoping that someone might be able to educate me on this small point.

      - Jeff

        • 1. Re: Forgive my ignorance
          timfox

          I believe ejb-ref is actually not a jboss or weblogic thing - it's part of the EJB spec.

          I think the idea is it allows your applications to be portable.

          By avoiding hard-coded JNDI references, if the actually locations change after build but before deploy, then you're application deployer can just change the ejb-ref entry in the deployment descriptor and your app. still works.

          Or something like that...

          I don't believe they're compulsory though - you can use hardcoded JNDI lookups if you want.