Java Dynamic Management Kit 4.2 Tutorial

Running the Minimal Agent Example

The example code for the MinimalAgent application is located in the examplesDir/MinimalAgent directory. As we saw, this agent application only has minimal output and is intended to be accessed for management through one of its communications MBeans. However, you will need to compile and launch the minimal agent if you continue on to the next topic.

Compile the MinimalAgent.java file in this directory with the javac command. For example, on the Solaris platform, you would type:


$ cd examplesDir/MinimalAgent/
$ javac -classpath classpath *.java

When we access the minimal agent through the HTML adaptor, we will instantiate the SimpleStandard and SimpleDynamic classes. Since we don't use a dynamic class loader, the agent will need these classes at runtime. You will need to have compiled the standard and dynamic MBean classes as described in "Running the Standard MBean Example" and "Running the Dynamic MBean Example". To run the example, update your classpath to find the MBeans and launch the agent class:


$ java -classpath classpath:../StandardMBean:../DynamicMBean MinimalAgent

This being a minimal agent, the example doesn't have much output. The MBean server is launched, and the three communication MBeans are created: it is now possible to connect to this agent. Management applications may connect through the HTTP and RMI connector servers, as described in "Connector Servers".

The simplest way to communicate with the agent is through the HTML protocol adaptor. This adaptor provides a view of the agent and its MBeans through standard HTML pages which can be viewed on almost any web browser. To connect to the agent, load the following URL in your browser:

http://localhost:8082/

If you get an error, you may have to switch off proxies in your preference settings or substitute your machine name for localhost. Any browser on your local network can also connect to this agent by using your machine name in this URL. In the next topic, "The HTML Protocol Adaptor", we will go into the details of managing this agent from its web view.