Java Reference
In-Depth Information
By default, ConnectorServerFactoryBean creates and starts a JMX connector server bound to the
service URL service:jmx: jmxmp://localhost:9875 , which exposes the JMX connector through the JMX
Messaging Protocol (JMXMP). However, most JMX implementations, including JDK 1.5's, don't support
JMXMP. Therefore, you should choose a widely supported remoting protocol for your JMX connector,
such as RMI. To expose your JMX connector through a specific protocol, you just provide the service
URL for it.
<beans ...>
<bean id="rmiRegistry"
class="org.springframework.remoting.rmi.RmiRegistryFactoryBean" />
<bean id="connectorServer"
<property name="serviceUrl" value=
"service:jmx: rmi://localhost/jndi/ rmi://localhost:1099/replicator" />
You specify the preceding URL to bind your JMX connector to an RMI registry listening on port
1099 of localhost. If no RMI registry has been created externally, you should create one by using
RmiRegistryFactoryBean . The default port for this registry is 1099, but you can specify another one in its
port property. Note that ConnectorServerFactoryBean must create the connector server after the RMI
registry is created and ready. You can set the depends-on attribute for this purpose.
Now your MBeans can be accessed remotely via RMI. When JConsole starts, you can enter the
following service URL on the Advanced tab of the connection window.
service:jmx: rmi://localhost/jndi/ rmi://localhost:1099/replicator
Assembling the Management Interface of MBeans
Recall that by default, the Spring MBeanExporter exports all public properties of a bean as MBean
attributes and all public methods as MBean operations. In fact, you can assemble the management
interface of your MBeans using an MBean assembler. The simplest MBean assembler in Spring is
MethodNameBasedMBeanInfoAssembler , which allows you to specify the names of the methods to export.
<beans ...>
<bean id="mbeanExporter"
<property name="assembler" ref="assembler" />
<bean id="assembler" class="org.springframework.jmx.export.assembler.
<property name="managedMethods">
Search WWH ::

Custom Search