apache/hadoop · error · IllegalStateException
Factory is not in CLIENT mode. Actual mode is {}
Error message
Factory is not in CLIENT mode. Actual mode is {} What it means
Error "Factory is not in CLIENT mode. Actual mode is {}" thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java:321
throw new IllegalStateException(
"Factory is not in SERVER mode. Actual mode is " + mode.toString());
}
return context.getServerSocketFactory();
}
/**
* Returns a configured SSLSocketFactory.
*
* @return the configured SSLSocketFactory.
* @throws GeneralSecurityException thrown if the SSLSocketFactory could not
* be initialized.
* @throws IOException thrown if and IO error occurred while loading
* the server keystore.
*/
public SSLSocketFactory createSSLSocketFactory()
throws GeneralSecurityException, IOException {
if (mode != Mode.CLIENT) {
throw new IllegalStateException(
"Factory is not in CLIENT mode. Actual mode is " + mode.toString());
}
return socketFactory;
}
/**
* Returns the hostname verifier it should be used in HttpsURLConnections.
*
* @return the hostname verifier.
*/
public HostnameVerifier getHostnameVerifier() {
if (mode != Mode.CLIENT) {
throw new IllegalStateException(
"Factory is not in CLIENT mode. Actual mode is " + mode.toString());
}
return hostnameVerifier;
}
View on GitHub (pinned to 2add963021)
Solutions
- Initialize the SSLFactory in CLIENT mode (sslFactory.init with Mode.CLIENT) before requesting client SSL socket factories.
- Check the calling code path: server-mode code is invoking a client-only SSLFactory method.
- Use separate SSLFactory instances for client and server usage.
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java:321 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/d3b4dc4bb0405619.
Report an issue: GitHub.