5 Replies Latest reply on Nov 6, 2003 7:32 AM by Darran Lofthouse

    Basic doubt on Initial Context Factory

    mukesh_babu Newbie

      Hi,
      I am new to J2EE and Jboss. I have a small doubt in initial context. I have a bean deployed and from client i want to access it so i should do a JNDI look up.
      For this i am using the following code :
      Properties p = new Properties();
      p.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      p.setProperty("java.naming.provider.url","jnp://" +m_serverHost + ":" + m_serverPort);
      tx= new InitialContext(p);
      home = ctx.lookup(beanName);

      The above code is working fine but i am able to look up the bean in following way also :
      Context ctx = new InitialContext();
      home = ctx.lookup(beanName);
      So my doubt is what is the advantage of setting the org.jnp.interfaces.NamingContextFactory and provider.url ?

      I will be thankful if some one can help in understanding the above doubt.
      I appreciate your help in this regard.
      Thankyou in advance.

      Regards,
      Vamsee.