title: ActiveMQ persistence: some troubles with AMQ Message Store
body: <p>I'm continuing to learn ActiveMQ, and have some question:
  I've read a lot ActiveMQ persistence references and docs, and noticed one thing - default message store (as I understand) is AMQ Message Store, that can be configured by such XML code snippet:</p>
  
  <pre><code>&lt;broker ...&gt;    
     ....
     &lt;persistenceAdapter&gt;
        &lt;amqPersistenceAdapter directory="activemq-data/store" maxFileLength="10mb"/&gt;
     &lt;/persistenceAdapter&gt;
     ....
  &lt;/broker&gt;
  </code></pre>
  
  <p>But I'm confused a little - when I looks through xml schema (<a href="http://activemq.apache.org/schema/core/activemq-core.xsd" rel="nofollow">http://activemq.apache.org/schema/core/activemq-core.xsd</a>) there is no element amqPersistenceAdapter. Don't I understand something?
  So it's an obvious that when I'm running my app an Exception occurs:</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 44 in XML document from class path resource [config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 86; cvc-complex-type.2.4.a: Invalid content was found starting with element 'amq:amqPersistenceAdapter'. One of '{"http://activemq.apache.org/schema/core":jdbcPersistenceAdapter, "http://activemq.apache.org/schema/core":journalPersistenceAdapter, "http://activemq.apache.org/schema/core":kahaDB, "http://activemq.apache.org/schema/core":levelDB, "http://activemq.apache.org/schema/core":mKahaDB, "http://activemq.apache.org/schema/core":memoryPersistenceAdapter, "http://activemq.apache.org/schema/core":replicatedLevelDB, WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at com.jmsexamples.Main.main(Main.java:7)
  Caused by: org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 86; cvc-complex-type.2.4.a: Invalid content was found starting with element 'amq:amqPersistenceAdapter'. One of '{"http://activemq.apache.org/schema/core":jdbcPersistenceAdapter, "http://activemq.apache.org/schema/core":journalPersistenceAdapter, "http://activemq.apache.org/schema/core":kahaDB, "http://activemq.apache.org/schema/core":levelDB, "http://activemq.apache.org/schema/core":mKahaDB, "http://activemq.apache.org/schema/core":memoryPersistenceAdapter, "http://activemq.apache.org/schema/core":replicatedLevelDB, WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1796)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:766)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:356)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
      at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
      ... 14 more
  </code></pre>
  
  <p>here is Spring config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:amq="http://activemq.apache.org/schema/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jms="http://www.springframework.org/schema/jms"
    xsi:schemaLocation="
          http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-4.1.xsd        
          http://www.springframework.org/schema/jms
      http://www.springframework.org/schema/jms/spring-jms-3.0.xsd
          http://activemq.apache.org/schema/core 
          http://activemq.apache.org/schema/core/activemq-core.xsd
      " &gt;
  
  
      &lt;bean 
              id="producer"
              class="com.jmsexamples.Producer"&gt;
          &lt;property name="connectionFactory" ref="jmsFactory" /&gt;  
      &lt;/bean&gt;
  
      &lt;bean 
              id="consumer"
              class="com.jmsexamples.Consumer"&gt; 
          &lt;property name="connectionFactory" ref="jmsFactory" /&gt;      
      &lt;/bean&gt;
  
      &lt;bean id="jdbc_ds" 
                  class="org.apache.commons.dbcp.BasicDataSource"
                  destroy-method="close"&gt;
          &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
          &lt;property name="url" value="jdbc:mysql://localhost:3306/ActiveMq?relaxAutoCommit=true" /&gt;
          &lt;property name="username" value="root" /&gt;
          &lt;property name="password" value="" /&gt;
          &lt;property name="poolPreparedStatements" value="true"/&gt;
      &lt;/bean&gt;
  
      &lt;amq:connectionFactory id="jmsFactory" brokerURL="tcp://localhost:61616"/&gt;
  
      &lt;amq:queue id="queue" physicalName="message.queue" /&gt;
  
      &lt;amq:broker id="msgBroker" persistent="true"&gt;
      &lt;amq:persistenceAdapter&gt;
         &lt;amq:amqPersistenceAdapter directory="activemq-data/store" maxFileLength="10mb"/&gt;
      &lt;/amq:persistenceAdapter&gt;
  
      &lt;amq:transportConnectors&gt;
        &lt;amq:transportConnector name="openwire" uri="tcp://localhost:61616" /&gt;
      &lt;/amq:transportConnectors&gt; 
  
    &lt;/amq:broker&gt;
  &lt;/beans&gt;
  </code></pre>