• Post Reply Bookmark Topic Watch Topic
  • New Topic

duplicate nick name as ejb references

 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for example:
ejb-jar.xml:
<ejb-ref>
<ejb-ref-name>ejb/MyHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.test.MyHome</home>
<remote>com.test.MyRemote</remote>
<ejb-link>Bean2</ejb-link>
</ejb-ref>

java code:
Context myInitCtx = new InitialContext();
Object result = myInitCtx.lookup("java:comp/env/ejb/MyHome");

in the xml, the <ejb-ref-name> is the nick name that we use.

my question is:
though EJB references are useful while changing JNDI locations and unavailable JNDI locations, is there a chance the nick name("ejb/MyHome") we use in EJB reference xml could be present already? which means it is unavailable. In which case, aren't we back to our original problem, unavailability of JNDI locations, in a roundabout way though(unavailable nick names).
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ejb-ref-names should be unique within the component for which you are defining this ejb-ref. For example, if you are configuring this ejb-ref for the MyBeanXYZ bean, then the ejb-ref-name should be unique within the ENC of this MyBeanXYZ bean.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!