How to Lookup a local entity bean - Help me out

Discussions

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.
    Thanks,
    Sachin
  2. Try

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

    But,

    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.
      

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

    Regards
    Samy
  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;
      
    be.swisslife.mwp.security.ses.UserMgrLocal myBean = home.create();



    Hope this help.

    Regards,

    Henda SAMMARI