apache/hadoop · error · ServletException
Keytab does not exist: ${keytab}
Error message
Keytab does not exist: ${keytab} What it means
Error "Keytab does not exist: ${keytab}" thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/KerberosAuthenticationHandler.java:156
*
* @param config configuration properties to initialize the handler.
*
* @throws ServletException thrown if the handler could not be initialized.
*/
@Override
public void init(Properties config) throws ServletException {
try {
String principal = config.getProperty(PRINCIPAL);
if (principal == null || principal.trim().length() == 0) {
throw new ServletException("Principal not defined in configuration");
}
keytab = config.getProperty(KEYTAB, keytab);
if (keytab == null || keytab.trim().length() == 0) {
throw new ServletException("Keytab not defined in configuration");
}
File keytabFile = new File(keytab);
if (!keytabFile.exists()) {
throw new ServletException("Keytab does not exist: " + keytab);
}
// use all SPNEGO principals in the keytab if a principal isn't
// specifically configured
final String[] spnegoPrincipals;
if (principal.equals("*")) {
spnegoPrincipals = KerberosUtil.getPrincipalNames(
keytab, Pattern.compile("HTTP/.*"));
if (spnegoPrincipals.length == 0) {
throw new ServletException("Principals do not exist in the keytab");
}
} else {
spnegoPrincipals = new String[]{principal};
}
KeyTab keytabInstance = KeyTab.getInstance(keytabFile);
serverSubject.getPrivateCredentials().add(keytabInstance);
for (String spnegoPrincipal : spnegoPrincipals) {
Principal krbPrincipal = new KerberosPrincipal(spnegoPrincipal);View on GitHub (pinned to 2add963021)
Solutions
- Create the keytab at the configured path or correct the kerberos.keytab property to point at an existing keytab file.
Example fix
kadmin.local: ktadd -k /etc/security/keytabs/spnego.service.keytab HTTP/host@REALM
When it happens
Trigger: Raised at runtime when the documented precondition or configuration requirement for this operation is violated.
Common situations: Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/6f7015fbcf330376.
Report an issue: GitHub.