J2EE: ejb-ref and raw JNDI Names ?

Discussion in 'Java' started by joes, Jul 1, 2004.

  1. joes

    joes Guest

    Hello there

    I am new to J2EE. I try to understand how we have to configure the web
    tier(servlet or jsp) in order to access an EJB over JNDI. So I am not
    quite sure if I did understand the ejb-ref principle. May be someone
    could delight me and explain me what the advantages there are.

    I saw that some examples are using a "<ejb-ref>" in the "web.xml" and
    in the specific "app.container-ejb-jar.xml". As far as I understand
    the EJB container is assigning a raw JNDI Name for registering the
    HomeObject. In order to avoid a hardcoding of a raw JNDI Name in the
    lookup part of my client code I should use a reference of this JNDI
    Name which is defined in the "app.container-ejb-jar.xml" and also in
    the "web.xml". And exactly at this point I do not understand the real
    advantage of <ejb-ref>. So some questions:

    - what is a raw JNDI name ? How could they physically look like ? What
    is the difference regarding the common JNDI Names as like
    "java:comp/env/MyName" ?

    - Does this mean it exists always two JNDI entries for a EJB
    HomeObject (a raw and a reference) ?

    - Why I have to define the reference mapping in both files, means once
    in the app.containe-ejb-jar.xml and once in the web.xml ? Because
    ejb-ref can only be used within the same container, so an application
    has also the same JNDI context. Why I do have to list it explicitely
    again in the web.xml ? i.e. sunone application container, j2ee
    tutorial converter.

    thank you in advance for any helpful comments regarding this.
    Mark
    joes, Jul 1, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mumbai Joe
    Replies:
    0
    Views:
    584
    Mumbai Joe
    Jul 29, 2003
  2. Mike S
    Replies:
    0
    Views:
    22,982
    Mike S
    Sep 16, 2004
  3. Mick
    Replies:
    2
    Views:
    9,499
    Marcin Grunwald
    Feb 23, 2005
  4. Raymond Schanks
    Replies:
    0
    Views:
    640
    Raymond Schanks
    Aug 3, 2010
  5. Justin C
    Replies:
    1
    Views:
    177
    Justin C
    Oct 7, 2013
Loading...

Share This Page