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 Enterprise Server runtime environment. For more information about the MBeanServer, see The MBeanServer in the Enterprise Server.
Here is a simple example of an asadmin create-mbean command in which TextPatterns is the implementation class. The --attributes and --target options are not required.
asadmin create-mbean --user adminuser --target server1 --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 GlassFish Enterprise Server v2.1.1 Reference Manual.
For more information about MBean attributes, see Handling MBean Attributes.
To redeploy an MBean, simply install its new classes into the Enterprise Server as described in MBean Class Loading. Then either restart the server or use asadmin delete-mbean followed by asadmin create-mbean.