Ya i made modifiacation according to that in my code...
even then now the new code is like this
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming.client");
properties.setProperty(Context.PROVIDER_URL,"jnp://localhost:1099");
Even after that its giving me unauthorised user.
Thanks in advance.