• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB ref

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is EJB ref, while deploying an EJB
Regards,
aakash
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ejb-ref elements in the standard ejb-jar.xml are used to specify logical references to another EJB the one being described is going to use. It's basically a promise/requirement saying "the application deployer must map this reference to a real JNDI name upon deployment".
For example, you have an EJB called CustomerBean that needs to use the AccountBean. You could just lookup the AccountBean from CustomerBean using the JNDI name that was used to deploy AccountBean with. This approach does have its sore points however. What happens if the application deployer finds out that the JNDI name the bean developer had assumed cannot be used in the production environment for some reason? The solution would be to abstract the real JNDI name from the CustomerBean by using ejb-ref.
The ejb-jar.xml of CustomerBean would define an ejb-ref so that CustomerBean code can use "java:comp/env/XXX" to lookup the AccountBean where "XXX" is anything the deployer wills. It is then the application deployer's job to specify the link between ejb-ref and the real JNDI name. With WebLogic, for example, this is done using weblogic-ejb-jar.xml (i.e. using the vendor-specific deployment descriptor).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic