apache/hadoop · error · IllegalArgumentException
Kerberos principal name does NOT have the expected hostname
Error message
Kerberos principal name does NOT have the expected hostname part:
What it means
Error "Kerberos principal name does NOT have the expected hostname part: " thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:346
"Server has invalid Kerberos principal: %s,"
+ " doesn't match the pattern: %s",
serverPrincipal, serverKeyPattern));
}
} else {
// check that the server advertised principal matches our conf
String confPrincipal = SecurityUtil.getServerPrincipal(
conf.get(serverKey), serverAddr.getAddress());
if (LOG.isDebugEnabled()) {
LOG.debug("getting serverKey: " + serverKey + " conf value: " + conf.get(serverKey)
+ " principal: " + confPrincipal);
}
if (confPrincipal == null || confPrincipal.isEmpty()) {
throw new IllegalArgumentException(
"Failed to specify server's Kerberos principal name");
}
KerberosName name = new KerberosName(confPrincipal);
if (name.getHostName() == null) {
throw new IllegalArgumentException(
"Kerberos principal name does NOT have the expected hostname part: "
+ confPrincipal);
}
if (!serverPrincipal.equals(confPrincipal)) {
throw new IllegalArgumentException(String.format(
"Server has invalid Kerberos principal: %s, expecting: %s",
serverPrincipal, confPrincipal));
}
}
return serverPrincipal;
}
/**
* Do client side SASL authentication with server via the given IpcStreams.
*
* @param ipcStreams ipcStreams.
* @return AuthMethod used to negotiate the connection
* @throws IOException raised on errors performing I/O.View on GitHub (pinned to 2add963021)
Solutions
- Use a Kerberos principal of the form service/hostname@REALM; the configured principal lacks a hostname component.
- Enable hostname canonicalization or fix reverse DNS so the hostname part can be derived.
- Correct the principal in the service configuration to include the fully qualified hostname.
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:346 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e1d43af197d87b39.
Report an issue: GitHub.