JSR-160 Connectors:-
For remote access, Spring JMX module provide two FactoryBean
implementations inside the org.springframework.jmx.support package for
creating both server- and client-side connectors.
1 Server-side Connectors:
Having Spring JMX create, start and expose a JSR-160 JMXConnectorServer use the
following configuration:
<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"/>
By default ConnectorServerFactoryBean creates a JMXConnectorServer bound to "service:jmx:jmxmp://localhost:9875". The serverConnector bean thus exposes the local MBeanServer to clients through the JMXMP protocol on localhost, port 9875.
Configure another URL and register the JMXConnectorServer itself with the MBeanServer use the serviceUrl and ObjectName properties respectively:
<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean">
<property name="objectName" value="connector:name=rmi"/>
<property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myconnector"/>
</bean>
when using a RMI-based connector you need the lookup service to be started in order for the name registration to complete.
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
<property name="port" value="1099"/>
</bean>
2 Client-side Connectors:
Create an MBeanServerConnection to a remote JSR-160 enabled
MBeanServer use the MBeanServerConnectionFactoryBean as shown below:
<bean id="clientConnector" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
<property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi"/>
</bean>