4 Replies Latest reply on Jan 13, 2007 7:48 PM by peterj

    Retrieving properties of an MBean

    iudoka

      I have the QuartzService MBean deployed on JBoss and I wanted to retrieve the MBean's properties that were loaded from the deployment file. Is there a clean way of doing this?

        • 1. Re: Retrieving properties of an MBean
          iudoka

          Please if anybody could point me in the right direction I would be very grateful. I know the JMX console is able to retrieve all the MBeans and displays all their properties through the web console. I just want to know how to do this, any information about this would really help thank you.

          • 2. Re: Retrieving properties of an MBean
            peterj
            • 3. Re: Retrieving properties of an MBean
              iudoka

               

              "PeterJ" wrote:
              See: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=88662 and the links in that post.


              Thanks Peter for your reply it was extremely helpful. However now I am getting an exception saying that the Context is not readable. I guess for security reasons, but is there a way around this? I couldn't find it on the link you provided. Thanks again, below is the exception I get


              javax.management.AttributeNotFoundException: Attribute 'Password' found, but it is not readable
              at org.jboss.mx.server.AbstractMBeanInvoker.getAttribute(AbstractMBeanInvoker.java:319)
              at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:541)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:251)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
              at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:164)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)EXITING!

              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
              at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
              at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
              at sun.rmi.transport.Transport$1.run(Transport.java:153)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
              at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
              at java.lang.Thread.run(Thread.java:595)


              • 4. Re: Retrieving properties of an MBean
                peterj

                If the property is marked as write only, there is no way to read it. Use the jmx-console to determine the read or write-ability of the property you are interested in.