Lookup Help

Discussions

EJB programming & troubleshooting: Lookup Help

  1. Lookup Help (3 messages)

    When I do a LookUp from a Session bean, Is it necessary to provide factory and provider information to get the initial context? Can someone help me and if possible provide a CODE snippet please.

    Thanks and eagerly looking for help.

    Threaded Messages (3)

  2. Lookup Help[ Go to top ]

    hi ,
      which application server r u using that is important.
    If u r using j2ee server then use
    Properties p=new Properties(System.getProperties());
    home = (ProductHome) ctx.lookup("ProductHome");

    or else
    if u r using weblogic 6.0 then use this
    Properties p=new Properties();
    p.putContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.TengahInitialContextFactory");
     p.put(Context.PROVIDER_URL,"t3://10.100.100.119:7001");
     Context ctx = new InitialContext(p);
    home = (ProductHome) ctx.lookup("ProductHome");

    i hope this should work for u
    bye
    -kiran
  3. Lookup Help[ Go to top ]

    Thanks for the information.

    But I am still not clear about this question:
    When I do a LookUp from a Session bean, Is it necessary to provide factory and provider information to get the initial context?

    I was refering in respect to WebSphere.

    Please reply,

  4. Lookup Help[ Go to top ]

    No its is not neccessary to provide factory and provider information to get the initial context when doing a lookup from session bean or for that matter any serverside code
    u can do this

    Context ctx = getInitialContext();