participate


JMX - Flaw in the way Model MBeans expose attributes.
<<   Back to Forum  |   Give us Feedback
This topic has 5 replies on 1 page.
sashamanster
Posts:2
Registered: 2/9/07
Flaw in the way Model MBeans expose attributes.   
Feb 9, 2007 4:57 PM

 
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.
 
sashamanster
Posts:2
Registered: 2/9/07
Re: Flaw in the way Model MBeans expose attributes.   
Feb 11, 2007 10:50 AM (reply 1 of 5)  (In reply to original post )

 
After a little more digging I found the bug report for this:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6339571

So I guess the good news is that it's being addressed, but it doesn't look like it will make it in until J2SE7 :-(
 
dfuchs
Posts:416
Registered: 1/5/06
Re: Flaw in the way Model MBeans expose attributes.   
Feb 12, 2007 1:51 AM (reply 2 of 5)  (In reply to #1 )

 
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
 
emcmanus
Posts:206
Registered: 1/27/98
Re: Flaw in the way Model MBeans expose attributes.   
Feb 13, 2007 6:45 AM (reply 3 of 5)  (In reply to original post )

 
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>.
 
Jabber.W
Posts:13
Registered: 1/29/07
Re: Flaw in the way Model MBeans expose attributes.   
Aug 14, 2007 12:42 AM (reply 4 of 5)  (In reply to #2 )

 
Hi Daniel.
I faced an issue seems be very close to the thread subj.
I have a Mbean exposed as ModelMBean. One of its attributes is defined as write only:
   ....
    desc.setField("setMethod", setterName)
    inf = ModelMBeanAttributeInfo(name, boolean.class.getName, description,
                                                           false, true, false, desc);
   ....
Still, I receive the error message on server console while browsing this mbean by jconsole:
 SEVERE: Failed to get "someBoolean": javax.management.AttributeNotFoundException
: getAttribute failed: someBoolean is not readable
Is it a jconsole problem - it tries to obtain all attr vals, including write-only, or m.b. just some my bug?

Thanx ahead,
Sincerely
Jabb
 
dfuchs
Posts:416
Registered: 1/5/06
Re: Flaw in the way Model MBeans expose attributes.   
Aug 14, 2007 3:39 AM (reply 5 of 5)  (In reply to #4 )

 
Hi,

If you're connecting with JConsole, the tool is going to try to get the value of all
attributes to display them, without checking whether some of them are write-only.

I think this is the reason for the log message you're observing.
With JDK 6 this results in a "SEVERE" message being spit out.
In JDK 7 it's a simple "WARNING" - though now that I think of it, it could
reasonably be downgraded to a simple "FINE/FINER" debug trace.
Standard MBean do not print any WARNING in this case so there's no reason
that RequiredModelMBean should.

I have logged
6592586 RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr
to track this.

Thanks for reporting this!

-- daniel
http://blogs.sun.com/jmxetc
 
This topic has 5 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 25
  • Guests : 145

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums