开发者

Different JNDI provider url for one case

开发者 https://www.devze.com 2023-04-01 15:37 出处:网络
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.

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

精彩评论

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

关注公众号