Properties p = new Properties(); p.setProperty(javax.naming.Context.PROVIDER_URL, "PROVIDER_URL");//PROVIDER_URL与你的应用服务器有关 p.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "INITIAL_CONTEXT_FACTORY");//INITIAL_CONTEXT_FACTORY与你的应用服务器有关 InitialContext context = new InitialContext(p); 应该就可以了。
ant ...
Properties p = new Properties(); p.setProperty(javax.naming.Context.PROVIDER_URL,
"PROVIDER_URL");//PROVIDER_URL与你的应用服务器有关 p.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"INITIAL_CONTEXT_FACTORY");//INITIAL_CONTEXT_FACTORY与你的应用服务器有关 InitialContext context = new InitialContext(p);
应该就可以了。
这样的话,调用起来不是很麻烦吗?????