title: Why does Activemq with ZooKeeper fail with NullPointerException upon stopping LevelDB service?
body: <p>I have a ZooKeeper cluster with 3 instances and Apache ActiveMQ 5.9.1 cluster. The ZooKeeper cluster starts fine, but ActiveMQ gives the following NullPointerException:</p>
  
  <pre><code> WARN | SASL configuration failed: javax.security.auth.login.LoginException: No
  JAAS configuration section named 'Client' was found in specified JAAS configurat
  ion file: 'D:\RepoHill30\apache-activemq\bin\..\conf\login.config'. Will continu
  e connection to Zookeeper server without SASL authentication, if Zookeeper serve
  r allows it.
   INFO | Opening socket connection to server 127.0.0.1/127.0.0.1:2888
   WARN | unprocessed event state: AuthFailed
  ERROR | Failed to start Apache ActiveMQ ([localhost, null], java.util.concurrent
  .TimeoutException: timeout reached while waiting on the lock: java.lang.Object@3
  33d4a8c)
   INFO | Apache ActiveMQ 5.9.1 (localhost, null) is shutting down
   INFO | Connector openwire stopped
   INFO | Connector amqp stopped
   INFO | Connector stomp stopped
   INFO | Connector mqtt stopped
   INFO | Connector ws stopped
  ERROR | Could not stop service: Replicated LevelDB[D:\RepoHill30\apache-activemq
  \bin\..\data\LevelDB, localhost:2888,localhost:2889,localhost:2890//activemq/lev
  eldb-stores]. Reason: java.lang.NullPointerException
  java.lang.NullPointerException
      at org.apache.activemq.leveldb.replicated.ElectingLevelDBStore.doStop(ElectingLevelDBStore.scala:276)
      at org.apache.activemq.util.ServiceSupport.stop(ServiceSupport.java:71)
      at org.apache.activemq.util.ServiceStopper.stop(ServiceStopper.java:41)
      at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:775)
      at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)
      at org.apache.activemq.broker.BrokerService.start(BrokerService.java:601)
      at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:88)
      at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
      at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
      at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
      at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
      at org.apache.activemq.console.Main.main(Main.java:115)
  </code></pre>
  
  <p><strong>Part of ActiveMQ configfile:</strong></p>
  
  <pre><code>&lt;persistenceAdapter&gt;
      &lt;replicatedLevelDB
        directory="${activemq.data}/LevelDB"
        replicas="3"
        bind="tcp://0.0.0.0:0"
        zkAddress="localhost:2888,localhost:2889,localhost:2890"
        zkPassword="password"
        zkPath="/activemq/leveldb-stores"
        hostname="localhost"
        /&gt;
  &lt;/persistenceAdapter&gt;
  </code></pre>
  
  <p><strong>Zookeeper configfile:</strong> </p>
  
  <pre><code>tickTime=2000
  dataDir=D:/zookeeper/zookeeper/cluster/server1/data
  clientPort=2181
  initLimit=5
  syncLimit=2
  server.1=localhost:2888:3888
  server.2=localhost:2889:3889
  server.3=localhost:2890:3890
  </code></pre>
  
  <p>Any help, please.</p>