Java Dynamic Management Kit 5.1 Tutorial

9.3 Examples of Connector Servers

The connector server examples demonstrate the following:

  1. The server:

    1. Creates an MBean server

    2. Creates an RMI or a JMXMP connector server

  2. The remote client:

    1. Creates an RMI or a JMXMP connector

    2. Creates a simple standard MBean in the MBean server, via the RMI connection

    3. Creates a generic notification listener.

  3. Basic operations are performed on the MBean registered in the MBean server, via the RMI connection

9.3.1 RMI Connector Server Example

The RMI connector server example is found in the examplesDir/current/Connectors/rmi directory.

To Run the RMI Connector Server Example
  1. Compile the Java classes.


    $ javac -classpath classpath *.java 
  2. Start an RMI registry on port 9999 of the local host.


    $ export CLASSPATH=.:classpath ; rmiregistry 9999 &
  3. Start the RMI connector server:


    $ java -classpath .:classpath Server &

    You will see confirmation of the creation of the MBean server and the RMI connector server.

  4. Start the RMI connector client:


    $ java -classpath .:classpath Client

    You will see confirmation of the creation of the RMI connector client and of the connection with the connector server. You will also be informed of the domain name, and the creation and registration of SimpleStandard MBean. The client will then perform operations on SimpleStandard MBean, before unregistering it.

9.3.2 JMXMP Connector Server Example

The JMXMP connector server example is found in the examplesDir/current/Connectors/jmxmp directory.

To Run the JMXMP Connector Server Example
  1. Compile the Java classes.


    $ javac -classpath classpath *.java 
  2. Start the JMXMP connector server:


    $ java -classpath .:classpath Server &

    You will see confirmation of the creation of the MBean server and the JMXMP connector server.

  3. Start the JMXMP connector client:


    $ java -classpath .:classpath Client

    You will see confirmation of the creation of the RMI connector client and of the connection with the connector server. You will also be informed of the domain name, and the creation and registration of SimpleStandard MBean. The client will then perform operations on SimpleStandard MBean, before unregistering it.