Support for write on write-only attribute

classic Classic list List threaded Threaded
2 messages Options
ovi ovi
Reply | Threaded
Open this post in threaded view
|

Support for write on write-only attribute

We have a write-only attribute exposed through JMX and we'd like to set its value through HTTP and Jolokia.
But I got an exception: javax.management.AttributeNotFoundException: Write-only attribute: ButtonRelease
(full stack trace at the end of this post).

This makes sense when looking at the WriteHandler.setAttribute(). One of the first step is

   Object oldValue = server.getAttribute(request.getObjectName(), request.getAttributeName());

which rightfully fails and prevent the setting of the value.

Note that setting the value of the attribute through the JConsole, directly in JMX works perfectly fine, even if no 'return' value is displayed - see screenshot

Is this a known limitation of Jolokia? Or a bug: as write-only attributes are valid constructions in JMX, it should be possible to set their value through Jolokia

Thanks for your supportJConsole screenshot showing the write-only attribute

{"request":{"mbean":"bean:name=HandPendantSimulator","attribute":"ButtonReleased","type":"write","value":"31"},
"stacktrace":"javax.management.AttributeNotFoundException: Write-only attribute: ButtonReleased\r\n\t
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(Unknown Source)\r\n\t
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(Unknown Source)\r\n\t
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(Unknown Source)\r\n\t
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(Unknown Source)\r\n\t
at org.jolokia.handler.WriteHandler.setAttribute(WriteHandler.java:93)\r\n\t
at org.jolokia.handler.WriteHandler.doHandleRequest(WriteHandler.java:74)\r\n\t
at org.jolokia.handler.WriteHandler.doHandleRequest(WriteHandler.java:38)\r\n\t
at org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:89)\r\n\t
at org.jolokia.backend.MBeanServerExecutorLocal.handleRequest(MBeanServerExecutorLocal.java:109)\r\n\t
at org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:161)\r\n\t
at org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:99)\r\n\t
at org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:429)\r\n\t
at org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:158)\r\n\t
at org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:197)\r\n\t
at org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:86)\r\n\t
at org.jolokia.jvmagent.handler.JolokiaHttpHandler.executeGetRequest(JolokiaHttpHandler.java:276)\r\n\t
at org.jolokia.jvmagent.handler.JolokiaHttpHandler.doHandle(JolokiaHttpHandler.java:233)\r\n\t
at org.jolokia.jvmagent.handler.JolokiaHttpHandler.handle(JolokiaHttpHandler.java:178)\r\n\t
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)\r\n\t
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)\r\n\t
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)\r\n\t
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)\r\n\t
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)\r\n\t
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)\r\n\t
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\t
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\t
at java.lang.Thread.run(Unknown Source)\r\n",
"error_type":"javax.management.AttributeNotFoundException","error":"javax.management.AttributeNotFoundException : Write-only attribute: ButtonReleased","status":404}

ovi ovi
Reply | Threaded
Open this post in threaded view
|

Re: Support for write on write-only attribute

This seems to match Jolokia issue#196: https://github.com/rhuss/jolokia/issues/196
No activity since creation in 2015...

Any body experiencing similar issue and looking for a fix? ;-)