How to Lookup a local entity bean - Help me out


EJB programming & troubleshooting: How to Lookup a local entity bean - Help me out

  1. Hi all,
    In weblogic 8.1, i am creating a application where i need to make an local entity bean.My Client also in the same jvm.

    Here are the Entity bean details:

    JNDI Name : depttLink
    Package name: demo
    Ejb name : deptt
    Local Home: demo.depttHome
    Local : demo.depttLocal
    ejb-class : demo.deptt
    i am calling JNDI name is like

    1. ctx.lookup("local:/ejb/depttLink")
    2. ctx.lookup("local:/ejb/ejb/depttLink")
    3. ctx.lookup("java:comp/env/depttLink")
    4. ctx.lookup("java:comp/depttLink")
    5. ctx.lookup("depttLink")

    But neither of these is working.Can any one help me. I am trying this from the last two days.
  2. Try

    You could try this : ctx.lookup("java:comp/env/ejb/depttLink")


    I think 'ctx.lookup("java:comp/env/depttLink")' should work.
    Did you have <ejb-local-ref> defined for the caller Bean.
    If that is the case then use local ref name.

  3. HI,
       I think this piece of code will help you.
    Context initialCtx;
    EJBLocalHome ejbLocalHome =(EJBLocalHome) PortableRemoteObject.
    narrow(initialCtx.lookup(jndiName), homeClass);

  4. Connect on local way[ Go to top ]

    I did it like this:

    InitialContext ctx = new InitialContext();
    Object o = ctx.lookup("UserMgrLocal");
    //Referring to <local-jndi-name>UserMgrLocal</local-jndi-name>
    UserMgrLocalHome home = (UserMgrLocalHome)o;
  myBean = home.create();

    Hope this help.


    Henda SAMMARI