Working with JMX MBeans on Liberty

You can access the attributes and call the operations of Java™ Management Extensions (JMX) management beans (MBeans) on Liberty. In addition, you can register your own MBeans from an application that is running on Liberty.

About this task

The primary interfaces for interacting with MBeans on Liberty are as follows:
  • javax.management.MBeanServer, which is for application code that is running on Liberty.
  • javax.management.MBeanServerConnection, which is for external code that is running in a separate Java virtual machine.
You can use an instance of either of these interfaces to access the attributes and call the operations of MBeans.

Procedure

  • For application code that is running on Liberty, you can use a javax.management.MBeanServer instance by using the following code:
    import java.lang.management.ManagementFactory;
    import javax.management.MBeanServer;
    
    ...
    
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    ...
  • For external code that is running in a separate Java virtual machine, you can use a javax.management.MBeanServerConnection instance. For more information, see Developing a JMX Java client for Liberty.
  • To access JMX REST APIs that are available through the REST Connector features, see Configuring secure JMX connection to Liberty. The REST APIs are used to manage MBean instances, invoke MBean operations, and query and modify MBean attributes.