0 Replies Latest reply on Jan 25, 2013 3:52 AM by Hans-Michael Rupp

    XMBean persistence does not work

    Hans-Michael Rupp Novice

      Hello,

       

      I am trying to implement a XMBean. It deploys, it is displayed in the JMX console, the attribute can be changed, however the the attribute value is not persisted. After a server restart the attribute value is back to the default (false)

       

      JBoss 4.2.3

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">

      <mbean>

          <description>Konfiguration von Sepa</description>

          <descriptors>

              <persistence persistPolicy="OnUpdate" persistPeriod="20000"

                  persistLocation="${jboss.server.data.dir}" persistName="Sepa.ser" />

              <currencyTimeLimit value="10" />

              <state-action-on-update value="keep-running" />

              <persistence-manager

                  value="org.jboss.mx.persistence.ObjectStreamPersistenceManager" />

          </descriptors>

          <class>bafoeg21.configuration.service.SepaManager</class>

          <constructor>

              <description>The default constructor</description>

              <name>Bafoeg21SepaManager</name>

          </constructor>

          <attribute access="read-write" getMethod="getUseSepa"

              setMethod="setUseSepa">

              <description>Soll Sepa anstatt DTAUS benutzt werden</description>

              <name>UseSepa</name>

              <type>java.lang.Boolean</type>

          </attribute>

          <operation>

              <description>The start lifecycle operation</description>

              <name>start</name>

          </operation>

          <operation>

              <description>The stop lifecycle operation</description>

              <name>stop</name>

          </operation>

      </mbean>

       

      public interface Sepa {

       

          public boolean getUseSepa();

          public void setUseSepa(Boolean useSepa);

       

          public void start();

          public void stop();

       

      }

       

      import org.apache.log4j.Logger;

      import org.jboss.annotation.ejb.Management;

      import org.jboss.annotation.ejb.Service;

       

      @Service(objectName="configuration.service:service=SepaManager", xmbean="resource:META-INF/bafoeg21sepa-xmbean.xml")

      //@Management(Sepa.class)

      public class SepaManager implements Sepa {

       

          private static Logger log = Logger.getLogger(SepaManager.class);

       

          private boolean useSepa;

       

          public SepaManager() {

              log.info("SepaManager constuctor");

          }

       

          @Override

          public boolean getUseSepa() {

              return this.useSepa;

          }

       

          @Override

          public void setUseSepa(Boolean useSepa) {

              this.useSepa = useSepa;

       

          }

       

          public void start() {

              log.info("SepaManager started");

          }

       

          public void stop() {

              log.info("SepaManager stoped");

          }

       

       

       

      }

       


      Thanks for any help