apache/hadoop · error · IllegalArgumentException

Can not use ldaps and StartTLS option at the same time

Error message

Can not use ldaps and StartTLS option at the same time

What it means

Thrown from LdapAuthenticationHandler.init when the provider URL uses the ldaps scheme and StartTLS is enabled at the same time. Both are mutually exclusive TLS mechanisms for the LDAP connection, so the configuration is contradictory.

Solutions

  1. Use either ldaps:// in the provider URL or enable StartTLS, not both.

Example fix

Change the URL to ldap:// and set ldap.enablestarttls=true, or keep ldaps:// with StartTLS false.
Defensive patterns

Strategy: validation

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/ff8e440da17c10de. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java:157

  public void init(Properties config) throws ServletException {
    this.baseDN = config.getProperty(BASE_DN);
    this.providerUrl = config.getProperty(PROVIDER_URL);
    this.ldapDomain = config.getProperty(LDAP_BIND_DOMAIN);
    this.enableStartTls =
        Boolean.valueOf(config.getProperty(ENABLE_START_TLS, "false"));

    if (this.providerUrl == null) {
      throw new NullPointerException("The LDAP URI can not be null");
    }
    if (!((this.baseDN == null)
        ^ (this.ldapDomain == null))) {
      throw new IllegalArgumentException(
          "Either LDAP base DN or LDAP domain value needs to be specified");
    }
    if (this.enableStartTls) {
      String tmp = this.providerUrl.toLowerCase();
      if (tmp.startsWith("ldaps")) {
        throw new IllegalArgumentException(
            "Can not use ldaps and StartTLS option at the same time");
      }
    }
  }

  @Override
  public void destroy() {
  }

  @Override
  public boolean managementOperation(AuthenticationToken token,
      HttpServletRequest request, HttpServletResponse response)
      throws IOException, AuthenticationException {
    return true;
  }

  @Override
  public AuthenticationToken authenticate(HttpServletRequest request,

View on GitHub (pinned to 2add963021)