Hi I just found that I needed to set an extra property after which my project run succesfully .
The property set is as follows :
Properties prop = new Properties();
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
prop.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
prop.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
prop.setProperty("j2ee.clientName", "ANSessionBeanClient"); //on adding this my project is running succesfully
On searching on web I found out at
here the usage of this