Here is the method that i always use with JBoss 3.2.3 :
public static Context getInitialContext() throws Exception {
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming
rg.jnp.interfaces");
return new InitialContext(prop);
}