Discussions

EJB programming & troubleshooting: why ejb ref defined twice

  1. why ejb ref defined twice (2 messages)

    in Jboss,for an ejbA lookup another ejb ejbb,
    in ejba's descriptor:
    ejb-jar.xml:
    <ejb-ref>
     <ejb-ref-name>ejb/ejbB</ejb-ref-name>
     <ejb-ref-type>Session</ejb-ref-type>
     <home>com.company.ejb.ejbBHome</home>
     <remote>com.company.ejb.ejbB</remote>
     <ejb-link>ejbB</ejb-link>
    </ejb-ref>

    in jboss.xml
    <ejb-ref>
    <ejb-ref-name>ejb/ejbB</ejb-ref-name>
    <jndi-name>ejbB</jndi-name>
    </ejb-ref>

    this defined ejb/ejbB is assoicated to ejbB
    but why it need to be defined twice?

    Threaded Messages (2)

  2. why ejb ref defined twice[ Go to top ]

    Hi!

    This is actually one of the great benefits of J2Ee (although you don't see it in a simple example)! By this mapping of names - remember you don't need to have the same name i both JNDI spaces - you can avoid global name conflicts. If, for example, two projects define different EJBs with the same name you can make them work together by changeing the name of one of the EJBs in the global JNDI namespace.

    /Tomas
  3. why ejb ref defined twice[ Go to top ]

    thank you.I'm not sure if I understand waht you mean.what does ejb-link do in ejb-jar.xml and what does jndi-name do in jboss.xml?