{"record":{"id":"b05fc10ecc911a99","repo":"apache/hadoop","slug":"mapreduce-jobhistory-webapp-address-does-not-conta","errorCode":null,"errorMessage":"MapReduce JobHistory WebApp Address does not contain a valid host:port authority: {}","messagePattern":"MapReduce JobHistory WebApp Address does not contain a valid host:port authority: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java","lineNumber":137,"sourceCode":"          JHAdminConfig.MR_HISTORY_BIND_HOST,\n          JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS,\n          JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS,\n          JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_PORT);\n    }\n  }\n  \n  public static String getApplicationWebURLOnJHSWithoutScheme(Configuration conf,\n      ApplicationId appId)\n      throws UnknownHostException {\n    //construct the history url for job\n    String addr = getJHSWebappURLWithoutScheme(conf);\n    String port;\n    try{\n      Iterator<String> it = ADDR_SPLITTER.split(addr).iterator();\n      it.next(); // ignore the bind host\n      port = it.next();\n    } catch(NoSuchElementException e) {\n      throw new IllegalArgumentException(\"MapReduce JobHistory WebApp Address\"\n        + \" does not contain a valid host:port authority: \" + addr);\n    }\n    // Use hs address to figure out the host for webapp\n    addr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS,\n        JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS);\n    String host = ADDR_SPLITTER.split(addr).iterator().next();\n    String hsAddress = JOINER.join(host, \":\", port);\n    InetSocketAddress address = NetUtils.createSocketAddr(\n      hsAddress, getDefaultJHSWebappPort(),\n      getDefaultJHSWebappURLWithoutScheme());\n    StringBuilder sb = new StringBuilder();\n    if (address.getAddress() != null &&\n        (address.getAddress().isAnyLocalAddress() ||\n         address.getAddress().isLoopbackAddress())) {\n      sb.append(InetAddress.getLocalHost().getCanonicalHostName());\n    } else {\n      sb.append(address.getHostName());\n    }","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\n<property><name>mapreduce.jobhistory.webapp.address</name><value>jhs-host</value></property>\n\n# after\n<property><name>mapreduce.jobhistory.webapp.address</name><value>jhs-host:19888</value></property>","handlingStrategy":"validation","validationCode":"static boolean hasPort(String addr) {\n  return addr != null && addr.lastIndexOf(':') > 0;\n}\nString jhsWeb = conf.get(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS,\n    JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS);\nif (!hasPort(jhsWeb)) throw new ConfigException(\n    \"mapreduce.jobhistory.webapp.address must be host:port, got: \" + jhsWeb);","typeGuard":null,"tryCatchPattern":"try {\n  url = MRWebAppUtil.getApplicationWebURLOnJHSWithoutScheme(conf, appId);\n} catch (IllegalArgumentException e) {\n  LOG.warn(\"Bad JHS webapp address; falling back to default port 19888\");\n  url = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf) + \"/jobhistory/job/\" + appId;\n}","preventionTips":["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+$"],"tags":["hadoop","mapreduce","jobhistory","webapp-address","configuration"],"backgroundTag":"invalid-service-address","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}