apache/hadoop · error · RuntimeException
This method is not supposed to be called at runtime. Use Hos
Error message
This method is not supposed to be called at runtime. Use HostUtil.getTaskLogUrl(String, String, String, String) instead.
What it means
HostUtil.getTaskLogUrl(String,String,String) is a deprecated stub kept only for binary compatibility with Hive 0.13 (MAPREDUCE-5830); any runtime call unconditionally throws RuntimeException. The working replacement is the 4-arg overload getTaskLogUrl(scheme, taskTrackerHostName, httpPort, taskAttemptID), which prepends the http scheme to build the tasklog URL. The 3-arg overload exists so old compiled code still links, but it is guaranteed to fail when executed.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/HostUtil.java:51
* @return the taskLogUrl
*/
public static String getTaskLogUrl(String scheme, String taskTrackerHostName,
String httpPort, String taskAttemptID) {
return (scheme + taskTrackerHostName + ":" +
httpPort + "/tasklog?attemptid=" + taskAttemptID);
}
/**
* Always throws {@link RuntimeException} because this method is not
* supposed to be called at runtime. This method is only for keeping
* binary compatibility with Hive 0.13. MAPREDUCE-5830 for the details.
* @deprecated Use {@link #getTaskLogUrl(String, String, String, String)}
* to construct the taskLogUrl.
*/
@Deprecated
public static String getTaskLogUrl(String taskTrackerHostName,
String httpPort, String taskAttemptID) {
throw new RuntimeException(
"This method is not supposed to be called at runtime. " +
"Use HostUtil.getTaskLogUrl(String, String, String, String) instead.");
}
public static String convertTrackerNameToHostName(String trackerName) {
// Ugly!
// Convert the trackerName to its host name
int indexOfColon = trackerName.indexOf(":");
String trackerHostName = (indexOfColon == -1) ?
trackerName :
trackerName.substring(0, indexOfColon);
return trackerHostName.substring("tracker_".length());
}
}
View on GitHub (pinned to 2add963021)
Solutions
- Replace the call with the 4-arg overload: HostUtil.getTaskLogUrl(scheme, taskTrackerHostName, httpPort, taskAttemptID) — scheme is e.g. "http://"
- Recompile/upgrade the calling application (Hive, Pig, custom tool) against the current Hadoop version so it links the new overload
- If the caller is a third-party tool you cannot rebuild, upgrade to a release that adopted the MAPREDUCE-5830 change
Example fix
// before
String url = HostUtil.getTaskLogUrl(hostName, httpPort, taskAttemptId);
// after
String url = HostUtil.getTaskLogUrl("http://", hostName, httpPort, taskAttemptId); Defensive patterns
Strategy: validation
Validate before calling
// fail fast at startup if the app links the removed-era 3-arg overload
for (java.lang.reflect.Method m : HostUtil.class.getMethods()) {
if (m.getName().equals("getTaskLogUrl")) {
int arity = m.getParameterCount();
if (arity != 4) {
throw new IllegalStateException("Incompatible HostUtil.getTaskLogUrl arity " + arity + "; rebuild against current Hadoop");
}
}
} Try / catch
try {
url = HostUtil.getTaskLogUrl(scheme, host, httpPort, attemptId);
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("not supposed to be called at runtime")) {
throw new IllegalStateException("Old 3-arg HostUtil.getTaskLogUrl invoked — rebuild against the 4-arg API", e);
}
throw e;
} Prevention
- Compile with -Xlint:deprecation and treat deprecation warnings on HostUtil as build errors
- Pin the Hadoop client version used to build the application to the version deployed on the cluster
- Never call the 3-arg getTaskLogUrl; it exists solely for Hive 0.13 binary compatibility
When it happens
Trigger: Client code compiled against Hadoop <= 2.3 invokes the 3-arg HostUtil.getTaskLogUrl(taskTrackerHostName, httpPort, taskAttemptID) at runtime — typically Hive 0.13-era tooling, Pig, or custom job-monitoring code that builds task log URLs. The call compiles and deploys fine because the overload still exists, then throws as soon as it is executed.
Common situations: Running an application built for Hadoop 2.2/2.3 (notably Hive 0.13 jobs or scripts using HostUtil directly) on a Hadoop 2.4+ cluster without recompiling; vendored jars that carry an old compiled call site; monitoring tools that hardcode the old signature.
Related errors
- Unable to recover task %s, output: %s
- Missing parent:${f}
- Unsupported call for block-compressed SequenceFiles - use Se
- Changing job priority in LocalJobRunner is not supported.
- Killing tasks in LocalJobRunner is not supported
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/afbfea0142a96fda.
Report an issue: GitHub.