1
我使用Spring 3並通過Spring公開了一個MBean,一切正常,但我在日誌文件中看到下面的警告消息。找到了多個MBean服務器 - Spring JMX with Websphere 7
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服務器,但是如果我們在多個環境中部署此代碼,代理ID可能不一樣(不能是靜態的)...
任何對此的投入表示讚賞...
感謝,基蘭
我得到PlatformMBeanServer和Sun的JmxMbeanServer。我沒有看到'WebContainer'Mbean。我不通過web容器加載這些bean,而是通過EJB容器加載(意味着EJB攔截器初始化Spring應用程序上下文)。但是,我發現了一種在配置中指定只使用'PlatformMBeanServer'的方法,My MBean似乎已經初始化正常,但我無法通過JConsole查看。 JConsole找不到我的Mbean。我不確定哪個Mbeanserver Jconsole正在加載.. – 2012-03-08 06:08:18