【问题标题】:Multiple MBean Servers found - Spring JMX with Websphere 7找到多个 MBean 服务器 - 带有 Websphere 7 的 Spring JMX
【发布时间】:2012-03-06 21:34:34
【问题描述】:

我正在使用 Spring 3 并通过 Spring 公开了一个 MBean,一切正常,但我在日志文件中看到以下警告消息。

WARN  org.springframework.jmx.support.JmxUtils  - Found more than one MBeanServer instance. Returning first from list.

这是我的配置:

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    <property name="assembler" ref="assembler" />
    <property name="namingStrategy" ref="namingStrategy" />
    <property name="autodetect" value="true" />
    <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/>
</bean>

<bean id="jmxAttributeSource"
    class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />

<bean id="assembler"
    class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
    <property name="attributeSource" ref="jmxAttributeSource" />
</bean>

<bean id="WASAdminService" class="com.ibm.websphere.management.AdminServiceFactory"
    factory-method="getAdminService" />

<bean id="namingStrategy" class="com.xxxx.WebSphereNamingStrategy">
    <constructor-arg ref="WASAdminService" />
</bean>

我放了一个调试点,发现它正在寻找 'com.ibm.ws.management.PlatformMBeanServer' 和 'com.sun.jmx.mbeanserver.JmxMBeanServer' 对象。知道为什么它会发现不止一个吗? google了一下,发现可以指定'agent id'来找到需要的MBean服务器,但是如果我们在多个环境中部署这段代码,agent id可能不一样(不能是静态的)...

对此的任何意见表示赞赏...

谢谢,基兰

【问题讨论】:

    标签: spring jmx websphere-7


    【解决方案1】:

    我的猜测是两个MBean服务器对应:

    1. “平台”MBean 服务器 - 由 JVM 建立。此 MBean 服务器将具有所有内置 Mbean,例如:java.lang:type=Runtime
    2. WebSphere 提供的 MBean 服务器 - 具有诸如 WebSphere:name=WebContainer,process=...之类的 MBeans

    我是这个领域的新手,但我正要进一步调查。从我的角度来看,我想指定 Platform Mbean 服务器 - 以便更容易从监控工具(如 JConsole 等)访问

    【讨论】:

    • 我得到了 PlatformMBeanServer 和 Sun 的 JmxMbeanServer。我没有看到我得到“WebContainer”Mbean。我不通过 web 容器加载这些 bean,而是通过 EJB 容器加载(意味着 EJB 拦截器初始化 spring 应用程序上下文)。但是,我找到了一种在配置中指定仅使用“PlatformMBeanServer”的方法,我的 MBean 似乎初始化正常,但我无法通过 JConsole 看到这一点。 JConsole 找不到我的 Mbean。我不确定正在加载哪个 Mbeanserver Jconsole..
    猜你喜欢
    • 2011-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多