Listing MBeans (list)

The list operation collects information about accessible MBeans. This information includes the MBean names, their attributes, operations and notifications along with type information and description (as far as they are provided by the MBean author which doesn’t seem to be often the case).

GET list request

The GET request format for a Jolokia list request is

<base-url>/list/<inner path>

The <inner path>, as described in Paths specifies a subset of the complete response. You can use this to select a specific domain, MBean or attribute/operation. See the next section for the format of the complete response.

POST list request

A list POST request has the following keys:

Table 1. POST list Request
Key Description Example

type

list

path

Inner path for accessing the value of a subset of the complete list Paths).

java.lang/type=Memory/attr

The following request fetches the information about the MBean java.lang:type=Memory

{
  "type": "list",
  "path": "java.lang/type=Memory"
}

List response

The value has the following format:

{
  "<domain>": {
    "<prop list>": {
      "attr": {
        "<attr name>": {
          "type": "<attribute type>",
          "desc": "<textual description of attribute>",
          "rw": "true|false"
        },
        ....
      },
      "op": {
        "<operation name>": {
          "args": [
            {
              "type": "<argument type>",
              "name": "<argument name>",
              "desc": "<textual description of argument>"
            },
            .....
          ],
          "ret": "<return type>",
          "desc": "<textual description of operation>"
        },
        .....
      },
      "not": {
        "name": "<name>",
        "desc": "<desc>",
        "types": [ "<type1>", "<type2>" ]
      }
    },
    ....
  },
  ....
}

The domain name and the property list together uniquely identify a single MBean. The property list is in the so called canonical order, i.e. in the form "<key1>=<val1>,<key2>=<val2>,.." where the keys are ordered alphabetically. Each MBean has zero or more attributes and operations which can be reached in an MBeans JSON object with the keys attr and op respectively. Within these groups the contained information is explained above in the schema and consist of Java types for attributes, arguments and return values, descriptive information and whether an attribute is writable (rw == true) or read-only.

As for reading attributes you can fetch a subset of this information using an path. E.g a path of domain/prop-list would return the value for a single bean only. For example, a request

http://localhost:8080/jolokia/list/java.lang/type=Memory

results in an answer

{
  "request": {
    "path": "java.lang/type=Memory",
    "type": "list"
  },
  "value": {
    "op": {
      "gc": {
        "args": [],
        "ret": "void",
        "desc": "gc"
      }
    },
    "notif": {
      "javax.management.Notification": {
        "types": [
          "java.management.memory.threshold.exceeded",
          "java.management.memory.collection.threshold.exceeded"
        ],
        "name": "javax.management.Notification",
        "desc": "Memory Notification"
      }
    },
    "attr": {
      "ObjectPendingFinalizationCount": {
        "rw": false,
        "type": "int",
        "desc": "ObjectPendingFinalizationCount"
      },
      "Verbose": {
        "rw": true,
        "type": "boolean",
        "desc": "Verbose"
      },
      "HeapMemoryUsage": {
        "rw": false,
        "type": "javax.management.openmbean.CompositeData",
        "desc": "HeapMemoryUsage"
      },
      "NonHeapMemoryUsage": {
        "rw": false,
        "type": "javax.management.openmbean.CompositeData",
        "desc": "NonHeapMemoryUsage"
      },
      "ObjectName": {
        "rw": false,
        "type": "javax.management.ObjectName",
        "desc": "ObjectName"
      }
    },
    "class": "sun.management.MemoryImpl",
    "desc": "Information on the management interface of the MBean"
  },
  "status": 200,
  "timestamp": 1702463340
}

Restrict depth of the returned tree

The optional parameter maxDepth can be used to restrict the depth of the return tree. Two value are possible: A maxDepth of 1 restricts the return value to a map with the JMX domains as keys, a maxDepth of 2 truncates the map returned to the domain names (first level) and the MBean’s properties (second level). The final values of the maps don’t have any meaning and are dummy values.

This page was built using the Antora default UI. The source code for this UI is licensed under the terms of the MPL-2.0 license. | Copyright © 2010 - 2023 Roland Huß