你需要设置这些参数,在应用服务器中这个已经作为系统属性了,所以直接获取就可以
而在客户机上就不一定设置了,所以你必须设置
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL,"iiop://yourhostname/");Context.INITIAL_CONTEXT_FACTORY根据你实际配置设置,我给了一个我自己的例子
而在客户机上就不一定设置了,所以你必须设置
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL,"iiop://yourhostname/");Context.INITIAL_CONTEXT_FACTORY根据你实际配置设置,我给了一个我自己的例子
jb生成是下面的代码,我应该怎样改呢??? private Context getInitialContext() throws NamingException
{
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
environment.put(Context.PROVIDER_URL, "corbaloc:iiop:192.168.0.101:2809");
environment.put(Context.URL_PKG_PREFIXES, "com.ibm.ws.naming");
return new InitialContext(environment);
}