You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用SolarWinds监控ActiveMQ Artemis启动失败问题排查

ActiveMQ Artemis启动失败排查(JMX配置错误导致)

问题背景

为通过SolarWinds监控ActiveMQ Artemis,修改bootstrap.xml配置JMX后,Artemis无法启动并抛出错误。

错误配置的bootstrap.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<broker xmlns="http://activemq.apache.org/schema">

    <jaas-security domain="activemq"/>

    <server configuration="file:/D:/apache-artemis-2.31.2-bin/apache-artemis-2.31.2/bin/slave/etc//broker.xml"/>

    <!-- JMX Connector Configuration -->
    <connectors>
        <connector connector-name="jmx" socket-binding="jmx" security-realm="ManagementRealm"/>
    </connectors>

    <!-- Socket Binding Configuration for JMX -->
    <socket-binding name="jmx" port="1099"/>

    <!-- The web server is only bound to localhost by default -->
    <web path="web" rootRedirectLocation="console">
        <binding uri="http://0.0.0.0:8161">
            <app name="branding" url="activemq-branding" war="activemq-branding.war"/>
            <app name="plugin" url="artemis-plugin" war="artemis-plugin.war"/>
            <app name="console" url="console" war="console.war"/>
        </binding>
    </web>
</broker>

启动错误日志

D:\apache-artemis-2.31.2-bin\apache-artemis-2.31.2\bin\slave\bin>artemis.cmd run
javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 21; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://activemq.apache.org/schema":connectors}'. One of '{"http://activemq.apache.org/schema":configurationFile, "http://activemq.apache.org/schema":configurationURI}' is expected.]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:453)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:387)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:356)
    at org.apache.activemq.artemis.dto.XmlUtil.decode(XmlUtil.java:114)
    at org.apache.activemq.artemis.cli.factory.xml.XmlBrokerFactoryHandler.createBroker(XmlBrokerFactoryHandler.java:35)
    at org.apache.activemq.artemis.cli.factory.BrokerFactory.createBrokerConfiguration(BrokerFactory.java:47)
    at org.apache.activemq.artemis.cli.factory.BrokerFactory.createBrokerConfiguration(BrokerFactory.java:54)
    at org.apache.activemq.artemis.cli.commands.Configurable.getBrokerDTO(Configurable.java:100)
    at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:83)
    at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:219)
    at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:165)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:157)
    at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:64)
Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 21; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://activemq.apache.org/schema":connectors}'. One of '{"http://activemq.apache.org/schema":configurationFile, "http://activemq.apache.org/schema":configurationURI}' is expected.
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:512)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3596)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1972)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:830)
    at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:571)
    at com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:71)
    at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:45)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:216)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:150)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:385)
    ... 13 more

问题原因

错误日志明确显示:bootstrap.xml的XML结构不符合Schema规范,<broker>根节点下,<server>元素后出现了不允许的<connectors>元素,Schema仅接受configurationFile或configurationURI元素在此位置。

本质错误是JMX配置放错了文件:bootstrap.xml仅用于指定broker核心配置文件路径,JMX连接器、socket绑定这类运行时配置属于broker业务配置,必须放在broker.xml中。

解决方案

1. 恢复bootstrap.xml

移除错误添加的<connectors>和<socket-binding>部分,还原后内容如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<broker xmlns="http://activemq.apache.org/schema">

    <jaas-security domain="activemq"/>

    <server configuration="file:/D:/apache-artemis-2.31.2-bin/apache-artemis-2.31.2/bin/slave/etc//broker.xml"/>

    <!-- The web server is only bound to localhost by default -->
    <web path="web" rootRedirectLocation="console">
        <binding uri="http://0.0.0.0:8161">
            <app name="branding" url="activemq-branding" war="activemq-branding.war"/>
            <app name="plugin" url="artemis-plugin" war="artemis-plugin.war"/>
            <app name="console" url="console" war="console.war"/>
        </binding>
    </web>
</broker>

2. 在broker.xml中配置JMX

打开bootstrap.xml中server元素指向的broker.xml文件,添加以下配置:

  • 确保开启JMX管理(若无<management>节点则新增):
    <management>
        <management-address>activemq.management</management-address>
        <management-notification-address>activemq.notifications</management-notification-address>
        <jmx-management-enabled>true</jmx-management-enabled>
    </management>
    
  • 在<connectors>节点下添加JMX连接器(修改监听地址为0.0.0.0允许远程访问):
    <connector name="jmx" uri="tcp://0.0.0.0:1099?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;httpEnabled=true;httpUpgradeEnabled=true;useEpoll=true"/>
    
  • 若需绑定固定端口,在<socket-bindings>节点下添加:
    <socket-binding name="jmx" port="1099"/>
    

3. 重启服务

完成配置后重启Artemis,即可正常启动并通过1099端口提供JMX监控服务,供SolarWinds连接。


内容的提问来源于stack exchange,提问作者Ahamed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 06:05:10