开发者

Simplest way of accessing a Spring-exported JMX bean on Websphere 7.0

开发者 https://www.devze.com 2023-02-28 01:32 出处:网络
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.

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.

I have tried connecting to WebSphere using the instructions from 开发者_如何学GoHow do you enable JMX in WebSphere with no success.

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


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.

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.

Here's an example:

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消