2 Replies Latest reply on Sep 29, 2004 1:32 PM by starksm64

    Setting attributes for a DynamicMBean in deployment XML

    eric4211

      Does anyone have any experience with setting attributes in the deployment xml of a DynamicMBean? Feel free to tell me to Read The Fine Manual, but please include a pointer to the correct docs.

      It seems that "attribute" sub-tags are ignored for DynamicMBeans. Has this been your experience as well? Should I be using something other than an "attribute" name/value tag?

      Cheers,
      -- Eric Herman

      ---------------
      I have created a sample "LightBulb" application and DynamicMBean that I can post if it would be useful.

      Here is my "lightbulb-service.xml" with the angle-brackets replaced with square brackets:
      [?xml version="1.0" encoding="UTF-8"?]

      [server]
      [mbean code="scratch.LightBulbDynamicMBean"
      name="scratch:type=service,name=lightbulb"]
      [attribute name="color" value="red" /]
      [/mbean]
      [/server]

        • 1. Re: Setting attributes for a DynamicMBean in deployment XML

          Eric;
          A couple of things:
          1) The attribute tag should look like this:

          [attribute name="color"]red[/attribute]


          2) Make sure that your public MBeanInfo getMBeanInfo() method is providing an array of MBeanAttributeInfo[] objects that contain color as an attribute.

          3) Make sure that your setAttribute(Attribute attribute) method can set the color attribute.

          That should do it.


          //Nicholas

          • 2. Re: Setting attributes for a DynamicMBean in deployment XML
            starksm64

            It makes no different how the mbean is implemented. The jboss-service.xml attribute setting simply gets translated into a setAttribute call through the mbean server. There is no value attribute on the attribute element so as Nicholas said the value needs to be passed as the text body of the attribute element.