{"record":{"id":"6aed7611857137d3","repo":"alibaba/nacos","slug":"ldap-auth-plugin-requires-org-springframework-ldap","errorCode":null,"errorMessage":"LDAP auth plugin requires org.springframework.ldap:spring-ldap-core in plugins/classpath when nacos.plugin.auth.type=ldap (legacy alias: nacos.core.auth.system.type=ldap). Please add spring-ldap-core jar into the plugins directory.","messagePattern":"LDAP auth plugin requires org\\.springframework\\.ldap:spring-ldap-core in plugins/classpath when nacos\\.plugin\\.auth\\.type=ldap \\(legacy alias: nacos\\.core\\.auth\\.system\\.type=ldap\\)\\. Please add spring-ldap-core jar into the plugins directory\\.","errorType":"exception","errorClass":"AccessException","httpStatus":401,"severity":"critical","filePath":"plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/authenticate/MissingLdapAuthenticationManager.java","lineNumber":39,"sourceCode":"import com.alibaba.nacos.plugin.auth.impl.users.NacosUser;\nimport jakarta.servlet.http.HttpServletRequest;\n\n/**\n * Fallback authentication manager for missing LDAP runtime dependency.\n *\n * @author xiweng.yy\n */\npublic class MissingLdapAuthenticationManager implements IAuthenticationManager {\n    \n    private final String message;\n    \n    public MissingLdapAuthenticationManager(String message) {\n        this.message = message;\n    }\n    \n    @Override\n    public NacosUser authenticate(String username, String rawPassword) throws AccessException {\n        throw new AccessException(message);\n    }\n    \n    @Override\n    public NacosUser authenticate(String jwtToken) throws AccessException {\n        throw new AccessException(message);\n    }\n    \n    @Override\n    public NacosUser authenticate(HttpServletRequest httpServletRequest) throws AccessException {\n        throw new AccessException(message);\n    }\n    \n    @Override\n    public void authorize(Permission permission, NacosUser nacosUser) throws AccessException {\n        throw new AccessException(message);\n    }\n    \n    @Override","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/authenticate/MissingLdapAuthenticationManager.java#L21-L57","documentation":"Thrown by MissingLdapAuthenticationManager.authenticate(username, rawPassword) — a stub implementation of IAuthenticationManager used when the LDAP auth plugin is selected (nacos.plugin.auth.type=ldap) but the required spring-ldap-core jar is absent from the plugins classpath. Every method on this stub throws AccessException with a descriptive configuration message so the server starts but login fails loudly rather than with a cryptic ClassNotFoundException.","triggerScenarios":"Server is configured with nacos.plugin.auth.type=ldap (or legacy nacos.core.auth.system.type=ldap) but the plugins directory does not contain org.springframework.ldap:spring-ldap-core. Any authentication call (username/password, JWT, or HttpServletRequest) routes to this stub and throws.","commonSituations":"After enabling LDAP auth, the deployer forgot to copy the spring-ldap-core jar into the Nacos plugins folder; or an upgrade changed the expected plugin directory layout.","solutions":["Download org.springframework.ldap:spring-ldap-core and place the jar in the Nacos plugins directory (typically plugins/ or the configured plugins.classpath).","Restart the Nacos server after adding the jar so it is loaded on the plugin classpath.","Verify the jar version is compatible with the Nacos LDAP auth plugin version."],"exampleFix":"# before: plugins dir has no spring-ldap-core\n# after: copy the jar into plugins/\ncp spring-ldap-core-<version>.jar /path/to/nacos/plugins/\n# then restart Nacos","handlingStrategy":"validation","validationCode":"// Before starting the server, verify the jar is present\n// java code to check classpath at startup:\ntry {\n    Class.forName(\"org.springframework.ldap.core.LdapTemplate\");\n} catch (ClassNotFoundException e) {\n    // spring-ldap-core missing; do not enable LDAP auth\n}","typeGuard":"static boolean isLdapCoreAvailable() {\n    try {\n        Class.forName(\"org.springframework.ldap.core.LdapTemplate\");\n        return true;\n    } catch (ClassNotFoundException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    NacosUser user = ldapAuthManager.authenticate(username, rawPassword);\n} catch (AccessException e) {\n    if (e.getMessage().contains(\"spring-ldap-core\")) {\n        // stop attempting logins; fix the plugins directory and restart\n    }\n}","preventionTips":["Add a pre-startup script that checks for spring-ldap-core in the plugins directory.","Include plugin-jar verification in the deployment runbook.","Restart Nacos after adding jars to the plugins directory."],"tags":["auth","ldap","classpath","plugin","missing-dependency","config","java"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}