Java Reference
In-Depth Information
Figure 2.8
The Admin View presented by the HTML adapter
■
Domain—
The
HTML
adapter defaults the Domain field to the domain of
the agent. Currently, it shows
HelloAgent
, which is your domain. This is
the first part of the object name.
■
Keys—
The Keys field requires input in the form
[name=value],*
. This field
represents the key/value portion of an object name.
■
Java Class—
This field requires a full Java class name of the class of the
MBean you want to create.
■
Class Loader—
The Class Loader field is the only field that is optional. You
can specify a class loader for the MBean server to use when attempting to
load the Java class specified in the previous field.
To get a good understanding of this page, let's use it to create some more MBeans.
As you will see in the next section, you can have many MBeans of the same type in
one
MBeanServer
, as long as their object names are unique.
2.5.4
Registering/unregistering MBeans on the HelloAgent
Let's load another instance of the
HelloWorld
MBean into the agent by using the
Admin View. Leave the domain value as
HelloAgent
. Type in
name=helloWorld2
for the Keys field. For the Java Class field, type
jmxbook.ch2.HelloWorld
, the
implementation of the
HelloWorldMBean
interface.
Any class you specify in the Java Class field must be accessible to the
MBeanServer
of the agent. For the
HelloAgent
, this requirement
means the input Java Class value must be in its local
CLASSPATH
.
NOTE