Accessing MBeans via Proxies - Java-Springs

Spring JMX allows you to create proxies that re-route calls to MBeans registered in a local or remote MBeanServer. These proxies provide you with a standard Java interface through which you can interact with your MBeans. The code below shows how to configure a proxy for an MBean running in a local MBeanServer:

<bean id="proxy"class="org.springframework.jmx.access.MBeanProxyFactoryBean">
<property name="objectName"value="bean:name=testBean"/>
<property name="proxyInterface"value="org.springframework.jmx.IJmxTestBean"/>

Here you can see that a proxy is created for the MBean registered under the ObjectName: bean:name=testBean. The set of interfaces that the proxy will implement is controlled by the proxyInterfaces property and the rules for mapping methods and properties on these interfaces to operations and attributes on the MBean are the same rules used by the InterfaceBasedMBeanInfoAssembler.

The MBeanProxyFactoryBean can create a proxy to any MBean that is accessible via an MBeanServerConnection. By default, the local MBeanServer is located and used, but you can override this and provide an MBeanServerConnection pointing to a remote MBeanServer to cater for proxies pointing to remote MBeans:

<bean id="clientConnector"
<property name="serviceUrl"
<bean id="proxy" class="org.
<property name="objectName"value="
<property name="proxyInterface"
<property name="server" ref="

Here you can see that we create an MBeanServerConnection pointing to a remote machine using the MBeanServerConnectionFactoryBean. This MBeanServerConnection is then passed to the MBeanProxyFactoryBean via the server property. The proxy that is created will forward all invocations to the MBeanServer via this MBeanServerConnection.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Java-Springs Topics