开发者

Different JNDI provider url for one case

I use remote EJB call to run my program.

Third party jar(who performs that call) needs different "java.naming.provider.url" than system one.

Any way to specify different provider url only for some sco开发者_如何学编程pe/class?


When you get the initial context you can specify such things. Example:

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
...
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
      "com.somecompany.naming.TheirInitialContextFactory");
env.put(Context.PROVIDER_URL,
      "corbaname:iiop:myhost.mycompany.com:9810/NameServiceServerRoot");
Context initialContext = new InitialContext(env);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜