{"record":{"id":"ff8e440da17c10de","repo":"apache/hadoop","slug":"can-not-use-ldaps-and-starttls-option-at-the-same","errorCode":null,"errorMessage":"Can not use ldaps and StartTLS option at the same time","messagePattern":"Can not use ldaps and StartTLS option at the same time","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java","lineNumber":157,"sourceCode":"  public void init(Properties config) throws ServletException {\n    this.baseDN = config.getProperty(BASE_DN);\n    this.providerUrl = config.getProperty(PROVIDER_URL);\n    this.ldapDomain = config.getProperty(LDAP_BIND_DOMAIN);\n    this.enableStartTls =\n        Boolean.valueOf(config.getProperty(ENABLE_START_TLS, \"false\"));\n\n    if (this.providerUrl == null) {\n      throw new NullPointerException(\"The LDAP URI can not be null\");\n    }\n    if (!((this.baseDN == null)\n        ^ (this.ldapDomain == null))) {\n      throw new IllegalArgumentException(\n          \"Either LDAP base DN or LDAP domain value needs to be specified\");\n    }\n    if (this.enableStartTls) {\n      String tmp = this.providerUrl.toLowerCase();\n      if (tmp.startsWith(\"ldaps\")) {\n        throw new IllegalArgumentException(\n            \"Can not use ldaps and StartTLS option at the same time\");\n      }\n    }\n  }\n\n  @Override\n  public void destroy() {\n  }\n\n  @Override\n  public boolean managementOperation(AuthenticationToken token,\n      HttpServletRequest request, HttpServletResponse response)\n      throws IOException, AuthenticationException {\n    return true;\n  }\n\n  @Override\n  public AuthenticationToken authenticate(HttpServletRequest request,","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java#L139-L175","documentation":"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.","triggerScenarios":"Raised at runtime when the documented precondition or configuration requirement for this operation is violated.","commonSituations":"Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.","solutions":["Use either ldaps:// in the provider URL or enable StartTLS, not both."],"exampleFix":"Change the URL to ldap:// and set ldap.enablestarttls=true, or keep ldaps:// with StartTLS false.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}