{"record":{"id":"7673b9ced5c6e331","repo":"spring-projects/spring-security","slug":"embedded-ldap-server-is-not-provided-7673b9","errorCode":null,"errorMessage":"Embedded LDAP server is not provided","messagePattern":"Embedded LDAP server is not provided","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"config/src/main/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParser.java","lineNumber":175,"sourceCode":"\t\t}\n\t\tldapContainer.getConstructorArgumentValues().addGenericArgumentValue(ldifs);\n\t\tldapContainer.getPropertyValues().addPropertyValue(\"port\", getPort(element));\n\t\tif (parserContext.getRegistry().containsBeanDefinition(BeanIds.EMBEDDED_UNBOUNDID)) {\n\t\t\tparserContext.getReaderContext()\n\t\t\t\t.error(\"Only one embedded server bean is allowed per application context\", element);\n\t\t}\n\t\tString beanId = resolveBeanId(mode);\n\t\tif (beanId != null) {\n\t\t\tparserContext.getRegistry().registerBeanDefinition(beanId, ldapContainer);\n\t\t}\n\t\treturn (RootBeanDefinition) contextSource.getBeanDefinition();\n\t}\n\n\tprivate RootBeanDefinition getRootBeanDefinition(String mode) {\n\t\tif (isUnboundIdEnabled(mode)) {\n\t\t\treturn new RootBeanDefinition(UNBOUNDID_CONTAINER_CLASSNAME, null, null);\n\t\t}\n\t\tthrow new IllegalStateException(\"Embedded LDAP server is not provided\");\n\t}\n\n\tprivate String resolveBeanId(String mode) {\n\t\tif (isUnboundIdEnabled(mode)) {\n\t\t\treturn BeanIds.EMBEDDED_UNBOUNDID;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate boolean isUnboundIdEnabled(String mode) {\n\t\treturn \"unboundid\".equals(mode) || unboundIdPresent;\n\t}\n\n\tprivate String getPort(Element element) {\n\t\tString port = element.getAttribute(ATT_PORT);\n\t\treturn (StringUtils.hasText(port) ? port : getDefaultPort());\n\t}\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/spring-projects/spring-security/blob/96852e8860138a482cb13d1479573f24ff6443c6/config/src/main/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParser.java#L157-L193","documentation":"LdapServerBeanDefinitionParser.getRootBeanDefinition() selects the embedded container implementation by mode; only UnboundID is supported. If isUnboundIdEnabled(mode) is false (i.e. mode set to a non-UnboundID value like the removed ApacheDS), it throws IllegalStateException because no embedded server implementation is available.","triggerScenarios":"<ldap-server/> with a mode attribute value other than the UnboundID-supported one (e.g. legacy mode=\"apacheds\"), causing isUnboundIdEnabled() to return false during bean definition parsing.","commonSituations":"Migrating from Spring Security 3.x where ApacheDS embedded mode existed; keeping mode=\"apacheds\" after upgrade; typos in the mode attribute.","solutions":["Remove the mode attribute or set it to the UnboundID mode so the UnboundID container bean definition is used.","Add the unboundid-ldapsdk dependency and drop legacy ApacheDS references.","Point <ldap-server/> at an external server (url attribute) instead of embedded mode."],"exampleFix":"// before\n<security:ldap-server mode=\"apacheds\" ldif=\"classpath:data.ldif\"/>\n\n// after\n<security:ldap-server ldif=\"classpath:data.ldif\"/>","handlingStrategy":"validation","validationCode":"String mode = element.getAttribute(\"mode\");\nif (mode != null && !mode.isEmpty() && !\"unboundid\".equals(mode)) {\n  throw new IllegalArgumentException(\"Unsupported embedded LDAP mode: \" + mode + \"; use UnboundID\");\n}","typeGuard":null,"tryCatchPattern":"try { parser.parse(element, parserContext); }\ncatch (IllegalStateException e) {\n  if (e.getMessage().contains(\"Embedded LDAP server is not provided\")) dropLegacyModeAttribute();\n}","preventionTips":["Remove legacy mode=\"apacheds\" attributes after upgrading to Spring Security 4+","Use external ldap url for non-UnboundID servers","Keep namespace schema validation enabled to catch invalid attribute values"],"tags":["spring-security","ldap","embedded-server","unsupported-option"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96852e8860138a482cb13d1479573f24ff6443c6","analyzedAt":"2026-09-10T23:25:23.477Z","contentChangedAt":"2026-09-10T23:25:23.477Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}