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 scope/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);