在Websphere 7.0上访问Spring导出的JMX Bean的最简单方法 [英] Simplest way of accessing a Spring-exported JMX bean on Websphere 7.0

查看:139
本文介绍了在Websphere 7.0上访问Spring导出的JMX Bean的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Spring导出我的JMX bean,对此我感到非常满意.当在另一个容器(例如Jetty,Tomcat)上运行时,我可以简单地使用JConsole或JVisualVM进行连接并访问我的MBean.

I currently export my JMX beans using Spring and am quite happy with it. When running on another container ( e.g. Jetty, Tomcat ) I can simply connect using JConsole or JVisualVM and access my MBeans.

我尝试使用中的说明连接到WebSphere.如何启用JMX在WebSphere 中没有成功.

I have tried connecting to WebSphere using the instructions from How do you enable JMX in WebSphere with no success.

在运行在WebSphere Application Server 7.0上的应用程序上,是否有更简单的方法来访问JMX bean?

Is there a simpler way of accessing JMX beans on an application running on WebSphere Application Server 7.0 ?

推荐答案

不确定您 不能 连接到WebSphere7 JMX,还是 可以 ,但看不到导出的MBean.如果是后者,则我怀疑您可能正在查看错误的MBeanServer实例,因为从技术上来说,WAS正在运行多个.

Not sure if you cannot connect to WebSphere7 JMX, or you can connect but do not see your exported MBeans. If it is the latter, I suspect you may be looking at the wrong MBeanServer instance, since WAS technically has more than one running.

无论哪种方式,要绕过所有这些废话,最好的选择是添加 JMXConnectorServer 定义.这样,您可以精确控制应该如何建立JMX连接,并且它将使用标准的J2SE RMI远程处理,因此您知道JConsole可以轻松地连接到它.

Either way, to bypass all that nonsense, your best bet is to add a JMXConnectorServer definition in your Spring XML. That way, you control exactly how the JMX connections should be made, and it will use the standard J2SE RMI remoting, so you know your JConsole will connect to it easily.

这是一个例子:

<bean id="MBeanServer"
    class="org.helios.jmx.util.MBeanServerFactory" lazy-init="false" factory-method="createMBeanServer">
    <constructor-arg type="java.lang.String" value="DefaultDomain" />
</bean>

<bean id="MBeanServerJMXUrl"
    class="javax.management.remote.JMXServiceURL" lazy-init="false">
    <constructor-arg type="java.lang.String" value="service:jmx:rmi:///jndi/rmi://localhost:8003/jmxrmi" />
</bean>

<bean id="RMIRegistry"
    class="java.rmi.registry.LocateRegistry" 
        lazy-init="false" 
        factory-method="createRegistry">
    <constructor-arg value="8003" />
</bean>


<bean id="MBeanServerConnector"
    class="javax.management.remote.JMXConnectorServerFactory" 
        lazy-init="false" 
        init-method="start"
        factory-method="newJMXConnectorServer"
        depends-on="RMIRegistry">
    <constructor-arg ref="MBeanServerJMXUrl" />
    <constructor-arg>
        <map/>
    </constructor-arg>
    <constructor-arg ref="MBeanServer" />
</bean>

这篇关于在Websphere 7.0上访问Spring导出的JMX Bean的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆