apache/hadoop · error · IllegalArgumentException
MapReduce JobHistory WebApp Address does not contain a valid
Error message
MapReduce JobHistory WebApp Address does not contain a valid host:port authority: {} What it means
MRWebAppUtil.getApplicationWebURLOnJHSWithoutScheme builds the JHS job URL by splitting the configured JobHistory webapp address on ':' — it discards the first token (bind host) and takes the second (port). If the address has fewer than two tokens (no port, or an empty value), the iterator throws NoSuchElementException, which is rethrown as IllegalArgumentException saying the address lacks a valid host:port authority.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java:137
JHAdminConfig.MR_HISTORY_BIND_HOST,
JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS,
JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS,
JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_PORT);
}
}
public static String getApplicationWebURLOnJHSWithoutScheme(Configuration conf,
ApplicationId appId)
throws UnknownHostException {
//construct the history url for job
String addr = getJHSWebappURLWithoutScheme(conf);
String port;
try{
Iterator<String> it = ADDR_SPLITTER.split(addr).iterator();
it.next(); // ignore the bind host
port = it.next();
} catch(NoSuchElementException e) {
throw new IllegalArgumentException("MapReduce JobHistory WebApp Address"
+ " does not contain a valid host:port authority: " + addr);
}
// Use hs address to figure out the host for webapp
addr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS,
JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS);
String host = ADDR_SPLITTER.split(addr).iterator().next();
String hsAddress = JOINER.join(host, ":", port);
InetSocketAddress address = NetUtils.createSocketAddr(
hsAddress, getDefaultJHSWebappPort(),
getDefaultJHSWebappURLWithoutScheme());
StringBuilder sb = new StringBuilder();
if (address.getAddress() != null &&
(address.getAddress().isAnyLocalAddress() ||
address.getAddress().isLoopbackAddress())) {
sb.append(InetAddress.getLocalHost().getCanonicalHostName());
} else {
sb.append(address.getHostName());
}View on GitHub (pinned to 2add963021)
Solutions
- Set mapreduce.jobhistory.webapp.address to host:port form (default 0.0.0.0:19888), e.g. jhs-host:19888
- For HTTPS check mapreduce.jobhistory.webapp.https.address likewise (default 0.0.0.0:19890)
- Lint the config at startup: assert the value matches ^[^/]+:\d+$ before running jobs
Example fix
# before <property><name>mapreduce.jobhistory.webapp.address</name><value>jhs-host</value></property> # after <property><name>mapreduce.jobhistory.webapp.address</name><value>jhs-host:19888</value></property>
Defensive patterns
Strategy: validation
Validate before calling
static boolean hasPort(String addr) {
return addr != null && addr.lastIndexOf(':') > 0;
}
String jhsWeb = conf.get(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS,
JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS);
if (!hasPort(jhsWeb)) throw new ConfigException(
"mapreduce.jobhistory.webapp.address must be host:port, got: " + jhsWeb); Try / catch
try {
url = MRWebAppUtil.getApplicationWebURLOnJHSWithoutScheme(conf, appId);
} catch (IllegalArgumentException e) {
LOG.warn("Bad JHS webapp address; falling back to default port 19888");
url = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf) + "/jobhistory/job/" + appId;
} Prevention
- Always configure mapreduce.jobhistory.webapp.address (and .https.address for TLS) as host:port
- Never substitute only a hostname variable into the address — include the port
- Add a startup config check that every *webapp.address value matches ^[^/]+:\d+$
When it happens
Trigger: mapreduce.jobhistory.webapp.address (or the https variant when SSL is on) set to a bare hostname or empty string, e.g. 'jhs-host' instead of 'jhs-host:19888'; a malformed value with no colon reaches the same path when a client builds the tracking URL.
Common situations: Hand-edited mapred-site.xml on the client that drops the port; environment-specific overrides that inject just $JHS_HOST; upgrading from configs where the key was removed and a stale partial value remains.
Related errors
- unable to load configuration for job: {jid}
- Invalid specification for distributed-cache artifacts of typ
- Unable to parse '{}' as a URI, check the setting for mapredu
- Could not locate MapReduce framework name '{}' in mapreduce.
- Type mismatch in key from map: expected {keyClassName}, rece
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b05fc10ecc911a99.
Report an issue: GitHub.