Flaw in the way Model MBeans expose attributes.

I have been searching the web for a while now trying to figure out a way to expose attributes using a model mbean withOUT also exposing the getters and/or setters of these attributes as operations. First off, it seems to me to be a bug in the JMX spec that when creating a ModelMBeanInfo object (for example, using an ModelMBeanInfoSupport), that each ModelMBeanAttributeInfo must also have corresponding ModelMBeanOperations for the getters and setters. Why the need for the duplication of effort and data? Furthermore, all JMX clients I've used (namely jconsole and jmanage) then show all those redundant getters and setters in the interface, completely cluttering up the list of operations (especially if there are a lot of attributes).

Has anyone been able to work around this while still using model mbeans? I've seen a bunch of posters to other forums with this problem (for example, see http://forum.springframework.org/archive/index.php/t-25943.html on the spring JMX forums), but no good solutions.

[1022 byte] By [sashamanstera] at [2007-11-26 17:59:41]
# 1
After a little more digging I found the bug report for this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6339571So I guess the good news is that it's being addressed, but it doesn't look like it will make it in until J2SE7 :-(
sashamanstera at 2007-7-9 5:28:54 > top of Java-index,Core,Monitoring & Management...
# 2

Hi,

Yes, this is a known oddity in the ModelMBean specification.

You may be interested in the article I have written about DynamicMBeans,

ModelMBeans, and Pojos...

<http://blogs.sun.com/jmxetc/entry/dynamicmbeans%2C_modelmbeans%2C_and_pojos...>

Cheers,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-9 5:28:54 > top of Java-index,Core,Monitoring & Management...
# 3
I've suggested a way to work around this problem in my blog. See < http://weblogs.java.net/blog/emcmanus/archive/2007/02/removing_getter.html>.
emcmanusa at 2007-7-9 5:28:54 > top of Java-index,Core,Monitoring & Management...