6

I have created some beans that implement an interface and created a custom MBean exporter to expose those beans to jconsole. Although everything works fine, the descriptions are not shown correctly. At the top of the bean I see:

Java Class :   $Proxy483
Description :   Information on the management interface of the MBean

and at the descriptions of the attributes and the operations I see:

Operation exposed for management

Is there any way to see the descriptions I have set in @ManagedResource annotations?

Thanks in advance

mprasinos
  • 89
  • 5

2 Answers2

0

You'll need a JmxAttributeSource implementation for your MBeanExporter (there is no default). Spring reference provides the following example:

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    <property name="assembler" ref="assembler"/>
    <property name="namingStrategy" ref="namingStrategy"/>
    <property name="autodetect" value="true"/>
</bean>

<!-- Implementation of the JmxAttributeSource interface that reads JDK 1.5+ annotations and exposes the corresponding attributes -->
<bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>

<!-- will create management interface using annotation metadata -->
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
    <property name="attributeSource" ref="jmxAttributeSource"/>
</bean>

<!-- will pick up the ObjectName from the annotation -->
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
    <property name="attributeSource" ref="jmxAttributeSource"/>
</bean>
Szymon Jednac
  • 2,969
  • 1
  • 29
  • 43
0

Have you try to provide object name and description?

@ManagedResource(
    objectName="org.springbyexample.jmx:name=ServerManager", 
    description="Server manager."
)
Sylvain
  • 21
  • 3