This section describes the following commands:
Use the asadmin create-mbean command to deploy, or register, an MBean.
Use the asadmin delete-mbean command to undeploy an MBean.
Use the asadmin list-mbeans command to list deployed MBeans.
After installing the MBean classes as explained in MBean Class Loading, use the asadmin create-mbean command to deploy the MBean. This registers the MBean in the MBeanServer that is part of the Application Server runtime environment. For more information about the MBeanServer, see The MBeanServer in the Application Server.
Here is a simple example of an asadmin create-mbean command in which TextPatterns is the implementation class. The --attributes option is not required.
asadmin create-mbean --user adminuser --attributes color=red:font=Times TextPatterns
Other options not included in the example are as follows:
--name defaults to the implementation class name
--objectname is explained in The MBean Life Cycle
--enabled defaults to true and is explained in Enabling and Disabling MBeans
All options must precede the implementation class.
For full details on the asadmin create-mbean command, see the Sun Java System Application Server Platform Edition 9 Reference Manual.
For more information about MBean attributes, see Handling MBean Attributes.
To redeploy an MBean, simply install its new classes into the Application Server as described in MBean Class Loading. Then either restart the server or use asadmin delete-mbean followed by asadmin create-mbean.
To undeploy an MBean, use the asadmin delete-mbean command. This removes its registration from the MBeanServer, but does not delete its code. Here is an example asadmin delete-mbean command in which TextPatterns is the implementation class.
asadmin delete-mbean --user adminuser TextPatterns
For full details on the asadmin delete-mbean command, see the Sun Java System Application Server Platform Edition 9 Reference Manual.
To list MBeans that have been deployed, use the asadmin list-mbeans command. Note that this command only lists the MBean definitions and not the MBeans registered in the MBeanServer. Here is an example asadmin list-mbeans command.
asadmin list-mbeans --user adminuser
The output of the asadmin list-mbeans command lists the following information:
Implementation class – The name of the implementation class without the extension.
Name – The name of the registered MBean, which defaults to but may be different from the implementation class name.
Object name – The ObjectName of the MBean, which is explained in The MBean Life Cycle.
Object type – For custom MBeans, the object type is always user. System MBeans have other object types.
Enabled – Whether the MBean is enabled. MBeans are enabled by default. See Enabling and Disabling MBeans.
For full details on the asadmin list-mbeans command, see the Sun Java System Application Server Platform Edition 9 Reference Manual.