我需要使用 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 | ERROR | Failed to load: class path resource [activemq.xml], reason: Line 109 in XML document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 109; columnNumber: 40; cvc-complex-type.2.4.a: Invalid content was found starting with element 'bean'. One of '{"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"]}' is expected. | org.apache.activemq.xbean.XBeanBrokerFactory | main org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 109 in XML document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 109; columnNumber: 40; cvc-complex-type.2.4.a: Invalid content was found starting with element 'bean'. One of '{"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"]}' is expected.
引用:
- mysql Ver 14.14 Distrib 5.5.22,用于使用 readline 6.2 的 debian-linux-gnu (x86_64)
- activemq 版本 5.6.0
最佳答案
我猜您是在 broker 标记内提供定义。请在代理外部创建数据源 bean。请引用这个link .
关于mysql - 使用 MySQL 配置 ActiveMQ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10764694/