diff --git a/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java b/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java index 74d839f802..525bb88b13 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java +++ b/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java @@ -183,6 +183,10 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life @SuppressWarnings("unchecked") public void stop() { + if (!isRunning()) { + return; + } + Properties env = new Properties(); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName()); env.setProperty(Context.SECURITY_AUTHENTICATION, "simple");