All naming service operations are performed on some implementation of the Context interface. Therefore, you need a way to obtain a Context for the naming service you are interested in using.
The javax.naming.IntialContext class implements the Context interface, and provides the starting point for interacting with a naming service.
When you create an InitialContext, it is initialized with properties from the environment. JNDI determines each property's value by merging the values from the following two sources, in order such as:
•The first occurrence of the property from the constructor's environment parameter and (for appropriate properties) the applet parameters and system properties.
•All jndi.properties resource files found on the classpath.
Properties required for InitialContext to work with Jboss are
>Context.INITIAL_CONTEXT_FACTORY : The name of environment property InitialContext to use with value "org.jnp.interfaces.NamingContextFactory" (this is for Jboss of not given javax.naming.NoInitialContextException will be thrown)
>Context.PROVIDER_URL : name of environment property for specifying location of JbossNS Service Provider