Where to specify Session Bean JNDI name

Discussions

EJB programming & troubleshooting: Where to specify Session Bean JNDI name

  1. Where to specify Session Bean JNDI name (2 messages)

    In general, which config file to modify to bind a Bean's JNDI name with the Bean? Say, if I call
    _context.lookup("java:comp/env/ejb/MySessionBean");
    Where do I specify the JNDI name "ejb/MySessionBean"?

    Thanks.
  2. Where to specify Session Bean JNDI name[ Go to top ]

    In general, which config file to modify to bind a Bean's JNDI name with the Bean? Say, if I call _context.lookup("java:comp/env/ejb/MySessionBean");Where do I specify the JNDI name "ejb/MySessionBean"? Thanks.
    Hi
    1)If you want to bind an EJB to JNDI name in a weblogic server , you need to make an entry in the weblogic-ejb-jar.xml file <jndi-name>SomeName</jndi-name>.
    2)The way in which you are looking for the EJB(as mentioned in your post),it seems that you are trying to use the EJB in some other EJB or from webapplication.If this is the case then you need to make an entry for the EJB you are looking up using code("java:comp/env/ejb/MySessionBean") as follows
    <ejb-ref>
    <ejb-ref-name>ejb/MySessionBean</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.MySessionHome</home>
    <remote>com.MySession</remote>
    </ejb-ref>
    For E.g: You are trying to use code mentioned by you in SessionBean1 , then this entry will go in the ejb-jar.xml of SessionBean1. This way is called as Environmental lookup of an EJB.
    Thanks
    Amit
  3. Accessing EJB from web app[ Go to top ]

    I'm accessing the Session bean from a web application and I'm using WebLogic. So, should I specify the <ejb-ref> entry in web application config file, say web.xml? Thanks.