Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3859

Initialization of XMBean attributes doesn't occur

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • JBossAS-4.0.3 SP1, JBossAS-4.0.5.GA, JBossAS-5.0.0.Beta1
    • JMX
    • None
    • Windows XP, Mac OSX 10.4.8, Java 1.5.0_04, 1.6.0

      The Wiki for initializing XMBean values upon deployment (see http://wiki.jboss.org/wiki/Wiki.jsp?page=HowCanIInitializeXMBeanAttributes) suggests 2 ways to set the initial value. One is to use a <descriptor>, the other is to use a plain <value> tag. This has been confirmed to be the way it should work by Dimitris (see forum thread).

      I have tried both ways on JBoss 4.0.3, 4.0.5, and JBoss 5.0.0 (JEE5_TCK) - using JDK1.5 and JDK 1.6, on XP and also on Mac .... and it does not set the initial value. Instead the value is always the default value "I've got the devil inside me" which comes from the String definition within the class file itself.
      (Incidentally, as an aside, if you change the value in the JMX Console and restart JBoss, then the value is correctly recovered from the persistence store).

      To reproduce, open the file $JBOSS_HOME\docs\examples\jmx\persistent-service.sar\META-INF\jboss-service.xml
      and edit the file as per the Wiki's suggestion. e.g. for attribute SomeString add a <value> tag as follows:
      <attribute access="read-write" getMethod="getSomeString" setMethod="setSomeString">
      <name>SomeString</name>
      <type>java.lang.String</type>
      <value>This is my initial value</value> <!-- this line is new -->
      </attribute>

      Copy this to the $JBOSS_HOME\server\default\deploy\ directory and start JBoss.

      Then view the XMBean using the JMX console:
      http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.jmx%3Aservice%3DPersistentServiceExample

      You will see that the value for SomeString is "I've got the devil inside me" from the class definition whereas I would expect it to be "This is my initial value" as taken from the XML file.

      (Incidentally, setting an MBean initial attribute does work, the persistence service example has such a value for SomeElement:
      "<some-message>Welcome to the Athens 2004, Olympic Games!</some-message>"
      But setting the XMBean initial attribute does not work)

      (Also, if the attribute is changed to read-only then there is no error upon deployment to show that the setting of the value has even been attempted.)

              adrian.brock Adrian Brock (Inactive)
              cnsxxx09 Chris (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: