如何通过基于jboss web的jmx-console公开activemq JMX MBean?

时间:2013-06-23 20:28:06

标签: jboss activemq jmx

我一直在尝试配置activemq,以便在http://localhost:8080/jmx-console提供的jboss基于web的jmx-console中提供代理MBean。

我试过了

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"     xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"     xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc     http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/tx     http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context     http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/util     http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-    core.xsd">
<beans>
    <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
        useShutdownHook="false">
        <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
        <managementContext>
            <!-- <managementContext createConnector="false" /> -->
            <managementContext>
                <MBeanServer>
                    <bean class="org.jboss.mx.util.MBeanServerLocator"
                        factory-method="locateJBoss" xmlns="" />
                </MBeanServer>
            </managementContext>
        </managementContext>
    </broker>
</beans>

当我部署战争时,xml片段会出错

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bean'.

知道如何让activemq MBeans与基于jboss web的jmx-console集成吗?

只有createConnector = false的默认设置对我来说不起作用,因为jboss配置为使用1099 RMI端口。在org.jboss.mx.util.MBeanServerLocator上的LocateJboss工厂方法调用是获取jboss MBeanServer句柄的唯一方法(我知道)。

1 个答案:

答案 0 :(得分:0)

根据spring JMX do c,您可以尝试这样的事情:

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
     <property name="server">
       <bean id="mBeanServerLocator" class="org.jboss.mx.util.MBeanServerLocator" 
                    factory-method="locateJBoss" />
     </property>
  </bean>
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
        useShutdownHook="false">
        <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
        <managementContext>
            <managementContext MBeanServer="exporter"/>     
            <!-- I am not sure what MBeanServer attribute is waiting for (a ref, an id, something else ...)-->
        </managementContext>
    </broker>