我需要使用MySQL设置ActiveMQ,我遵循这篇文章 http://note19.com/2007/06/23/configure-activemq-with-mysql/
我发现我的配置低于配置。 MQ无法启动
<bean id="mysql-ds"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url"
value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
<property name="username" value="xxxx"/>
<property name="password" value="xxxx"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
以下是错误
2012-05-25 18:40:46,565 |错误|无法加载:类路径资源 [activemq.xml],原因:来自类路径的XML文档中的第109行 资源[activemq.xml]无效;嵌套异常是 org.xml.sax.SAXParseException; lineNumber:109; columnNumber:40; cvc-complex-type.2.4.a:找到无效的内容 元素'bean'。之一 “{“http://activemq.apache.org/schema/core":adminView, “http://activemq.apache.org/schema/core":brokerContext, “http://activemq.apache.org/schema/core":consumerSystemUsage, “http://activemq.apache.org/schema/core":destinationFactory, “http://activemq.apache.org/schema/core":destinationInterceptors, “http://activemq.apache.org/schema/core":destinationPolicy, “http://activemq.apache.org/schema/core":destinations, “http://activemq.apache.org/schema/core":ioExceptionHandler, “http://activemq.apache.org/schema/core":jmsBridgeConnectors, “http://activemq.apache.org/schema/core":managementContext, “http://activemq.apache.org/schema/core":messageAuthorizationPolicy, “http://activemq.apache.org/schema/core":networkConnectorURIs, “http://activemq.apache.org/schema/core":networkConnectors, “http://activemq.apache.org/schema/core":persistenceAdapter, “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":shutdownHooks, “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”]}'是预料之中的。 | org.apache.activemq.xbean.XBeanBrokerFactory |主要 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 来自类路径资源[activemq.xml]的XML文档中的第109行是 无效;嵌套异常是org.xml.sax.SAXParseException; lineNumber:109; columnNumber:40; cvc-complex-type.2.4.a:无效 找到以元素'bean'开头的内容。之一 “{“http://activemq.apache.org/schema/core":adminView, “http://activemq.apache.org/schema/core":brokerContext, “http://activemq.apache.org/schema/core":consumerSystemUsage, “http://activemq.apache.org/schema/core":destinationFactory, “http://activemq.apache.org/schema/core":destinationInterceptors, “http://activemq.apache.org/schema/core":destinationPolicy, “http://activemq.apache.org/schema/core":destinations, “http://activemq.apache.org/schema/core":ioExceptionHandler, “http://activemq.apache.org/schema/core":jmsBridgeConnectors, “http://activemq.apache.org/schema/core":managementContext, “http://activemq.apache.org/schema/core":messageAuthorizationPolicy, “http://activemq.apache.org/schema/core":networkConnectorURIs, “http://activemq.apache.org/schema/core":networkConnectors, “http://activemq.apache.org/schema/core":persistenceAdapter, “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":shutdownHooks, “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”]}'是预期的。
REF:
答案 0 :(得分:4)
我猜你在代理商标签中提供定义。请在代理外部创建数据源bean。请参阅此link。
答案 1 :(得分:1)
引用博客上的示例已过期。持久性元素应定义为:
<persistenceFactory>
<journalPersistenceAdapterFactory
journalLogFiles="5"
dataDirectory="${basedir}/activemq-data"
dataSource="#mysql-ds"/>
</persistenceFactory>
这应解决问题。
此致 Scott ES