I'm trying to register mbeans by spring annotation. The beans were showing correctly in the jconsole but the attributes and methods defined in the class didn't show up. What's wrong with it?
here's one mbean for example:
@ManagedResource(objectName="com.xormedia.aqua.mbean:name=AuthenticationServer",description="AuthenticationServerSummary")
public class AuthenticationServerSummaryMbean implements MonitorMXBean {
private String ip;
private String port;
@ManagedAttribute
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
@ManagedOperation(description="show port number")
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
}
I followed the guides online, configuring the spring xml but there are only mbeans without any tree structure for the attributes and methods.
Just like this.
Try to change your approach into the following:
Add
<context:mbean-export/>
in your spring config.Change your class a bit:
Register your mBean: