Hi, are you using Spring 3.0 in your application? I've seen this when tried to upgrade Spring to 3.0. Still didn't find time to dig into the root of the problem, but basically it seems that ordering of elements is now necessary. So just, move 'destinationPolicy' tag up and everything should be fine.
Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Mon, Feb 8, 2010 at 6:07 PM, khunter <khun...@allmanint.com> wrote: > > I wrote a tiny bit of code intending to experiment with starting up an > ActiveMQ instance inside a web application (with the intention of > eventually > using an "in the VM" configuration). I'm using ActiveMQ version 5.3.0, and > Java 1.6.0_17. > > To start with, I simply tried to start an instance programmatically: > =================== > String uri = "xbean:file:/java/apache-activemq-5.3.0/conf/activemq.xml"; > > try > { > BrokerService service = BrokerFactory.createBroker(uri); > service.start(); > Thread.sleep(5*1000L); > service.stop(); > service.waitUntilStopped(); > } > catch(Exception e) > { > e.printStackTrace(); > } > =================== > > The path string above is pointing to the "activemq.xml" that came with the > distribution - I haven't altered that file in any way. (I understand that > it has references in it to ${activemq.base} that won't resolve correctly, > under this method, but that isn't the problem I'm facing. > > What happens is that the "createBroker" line above throws an exception: > > =================== > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line > 70 in XML document from URL > [file:/java/apache-activemq-5.3.0/conf/activemq.xml] is invalid; nested > exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid > content was found starting with element 'destinationPolicy'. One of > '{"http://activemq.apache.org/schema/core":persistenceFactory, > "http://activemq.apache.org/schema/core":persistenceTaskRunnerFactory, > "http://activemq.apache.org/schema/core":plugins, > "http://activemq.apache.org/schema/core":producerSystemUsage, > "http://activemq.apache.org/schema/core":proxyConnectors, > "http://activemq.apache.org/schema/core":regionBroker, > "http://activemq.apache.org/schema/core":services, > "http://activemq.apache.org/schema/core":sslContext, > "http://activemq.apache.org/schema/core":systemUsage, > "http://activemq.apache.org/schema/core":taskRunnerFactory, > "http://activemq.apache.org/schema/core":tempDataStore, > "http://activemq.apache.org/schema/core":transportConnectorURIs, > "http://activemq.apache.org/schema/core":transportConnectors, > WC[##other:"http://activemq.apache.org/schema/core"]}' is expected. > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:111) > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:104) > at > > org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) > at > > org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:458) > at > > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:388) > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) > at > > org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:96) > at > > org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:52) > at > > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) > at > > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) > at > > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:85) > at test.BrokerRunner.main(BrokerRunner.java:14) > Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid > content was found starting with element 'destinationPolicy'. One of > '{"http://activemq.apache.org/schema/core":persistenceFactory, > "http://activemq.apache.org/schema/core":persistenceTaskRunnerFactory, > "http://activemq.apache.org/schema/core":plugins, > "http://activemq.apache.org/schema/core":producerSystemUsage, > "http://activemq.apache.org/schema/core":proxyConnectors, > "http://activemq.apache.org/schema/core":regionBroker, > "http://activemq.apache.org/schema/core":services, > "http://activemq.apache.org/schema/core":sslContext, > "http://activemq.apache.org/schema/core":systemUsage, > "http://activemq.apache.org/schema/core":taskRunnerFactory, > "http://activemq.apache.org/schema/core":tempDataStore, > "http://activemq.apache.org/schema/core":transportConnectorURIs, > "http://activemq.apache.org/schema/core":transportConnectors, > WC[##other:"http://activemq.apache.org/schema/core"]}' is expected. > at > > com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) > at > > com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) > at > > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) > at > > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) > at > > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410) > at > > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165) > at > > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1777) > at > > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685) > at > > com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) > at > > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747) > at > > com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) > at > > com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) > 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:807) > at > > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) > at > > com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) > at > > com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225) > at > > com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283) > at > > org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) > ... 15 more > > =================== > > As I read this, the XML parser is objecting to the "destinationPolicy" tag > that it's finding on line 70 of the activemq.xml file. What is confusing > me > is why this file, which came with the distribution, and which obviously > works if I invoke ActiveMQ from the command line, should be exhibiting this > behavior when I try to use it to create a Broker manually. Am I attempting > to load the XML file in an incorrect manner? > > Any help would be greatly appreciated. > > Kevin Hunter > -- > View this message in context: > http://old.nabble.com/SAXParseException-using-default-activemq.xml-tp27502989p27502989.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >