How to add description for MBean method to see it in jmx-console of JBOSS


Solution 1

In Java, you can do this, if you don't use standard MBeans, but e.g. DynamicMBeans for which you need to implement getMBeanInfo() which is returning all that data. This is a generic way, not limited to JBoss. But it is also a lot of work, which (IMO) only makes sense if you really need the dynamic features of a DynamicMBean.

For completeness sake (and as this may be the easier approach):

You can write an xmbean-descriptor and put that e.g. into $SERVER/conf/xmdesc/ In addition to this you need to enhance the standard MBeean-descriptor like this (note the xmbean-dd attribute:

<mbean code="org.jnp.server.NamingBeanImpl"

This example is taken from $SERVER/conf/jboss-service.xml and the NamingBean-xmban.xml is in the path described by the attribute.

Solution 2

I have created a small wrapper that will create a dynamic MBean out of a normal Java class through annotations. With it you can also add descriptions to beans, attributes, operations and parameters.

It also supports externalization and localization of names and descriptions using Java ResourceBundles.

Example of an annotated class:

@JMXBean(description = "My first JMX bean test")
public class MyBean {
    int level = 0;

    @JMXBeanAttribute(name = "Floor Level", description = "The current floor level")
    public int getLevel() {
      return level;

    public void setLevel(int newLevel) {
      level = newLevel;

    @JMXBeanOperation(name = "Echo Test", description = "Echoes the parameter back to you")
    public String myMethod(
             @JMXBeanParameter(name = "Input", description = "String of what to echo") String param) {
      return "You said " + param;

Example of an annotated class using ResourceBundles:

public class MyBean {

  int level = 0;

  @JMXBeanAttribute(nameKey="level", descriptionKey="levelDescription")
  public int getLevel() {
    return level;

How to use it:

MyBean bean = new MyBean();
JMXBeanWrapper wrappedBean = new JMXBeanWrapper(bean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(wrappedBean, new Objectname(",name=My Bean"));

You can find the source on GitHub

Solution 3

I've had success with mixing Spring XML and Spring annotations where I had multiple MBeans of the same Java class. The approach allowed tight control over bean names and allowed me to define descriptions etc at the class level. I needed to define an annotation based bean assembler for an MBeanExporter, and supply a map of bean names and bean references:

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"
    <property name="server" ref="mbeanServer" />
    <property name="assembler">
        <!-- will create management interface using annotation metadata -->
        <bean class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
            <property name="attributeSource">
                <bean class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>
    <property name="beans">
           <!-- entries -->

An example of what I read from Java annotations might be:

@ManagedAttribute(description = "A detailed description to show in JConsole tooltips etc")
public String getFoo() {
    return foo;

I had the assemblers defined privately to the exporter, but you could share those beans more widely I'm sure.

BTW this was on Tomcat.

Author by


Updated on June 05, 2022


  • Zaur_M
    Zaur_M less than a minute

    I'm using JBoss 4.3.2.GA

    I've added method to my MBean service. Method has several arguments in signature. It works fine but I want more.

    Problem: when I see method signature in jmx-console, I don't know what every of this input fields means, because jmx-console doesn't show arguments names, only input fields for values.

    Is there ability add description of every argument (in Java code, not xml) allowing to show this description in jmx-console of JBOSS?

    I've tried to use Spring annotation: @ManagedOperation to add at least method description but no results (description is not showed in jmx-console).

    May be some one have resolved such issue...