neoeahit neoeahit - 10 months ago 50
Java Question

How to use jolokia to retrive mbean for a class

I have a mbean for a class say
and I want to use jolokia to list all loggers?

I have tried reading on but that tells me how to get values of predefined java.memory etc

Please suggest on how to get jolokia to retrieve loggers for a user-defined class


You have to keep in mind that even if your mbean is a singleton in your servlet, your servlet could be running on multiple endpoints - that's why the namespace alone is not sufficient to identify your mbean instance.

If you want to get all instances of, you can use the read endpoint like this:


In general, you can get a list of all your available mbeans like this:


You should end up with a large json document that contains everything you might want to fetch. You will see things like

"": {
  "name=foo,type=MyLogger": {
    "desc": ...
    "attr": {

You can now get the attributes using something like this:


In addition to type and name, you may see other fields as well, for example context or id. This a:b key is the Java ObjectName for your mbean.