Вопрос не очень понятен. Согласно документации JNDI , свойство url указывает местоположение реестра в формате rmi: // server: port. Поэтому, по крайней мере, когда вы изначально создаете контекст именования для привязок для объектов, зарегистрированных в реестре, вам нужно указать местоположение реестра. Вы можете найти образец кода здесь :
// select the registry service provider as the initial context
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
// specify where the registry is running
env.put(Context.PROVIDER_URL, "rmi://server:1099");
// create an initial context that accesses the registry
Context ctx = new InitialContext(env);
// now, the names stored in registry can be listed
NamingEnumeration enum = ctx.list("");