0 Replies Latest reply on Sep 24, 2009 2:31 PM by tosca acosot

    Cannot persist xmbean

    tosca acosot Newbie

      I used the persistent-service.sar example, made it into a non service jar and deployed it.

      I'm able to access the bean from the jmx console, get and set properties, but it is never persisted. Why would that be?

      the only changes I made are:

      Put this at the beginning of the class
      @Service (objectName="jboss.jmx:service=PersistentServiceExample", xmbean="resource:ps-xmbean.xml")

      Created ps-xmbean.xml, modified it to confirm to xmbean schema.

      Only persistence doesn't work. Any pointer on how to debug would be greatly appreciated.
      modified jboss-service.xml (ps-xmbean.xml)

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE mbean PUBLIC
       "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
      <!-- $Id: jboss-service.xml 23704 2004-09-14 20:29:40Z andd $ -->
      <!-- ===================================================================== -->
      <!-- -->
      <!-- Example Service using "external" XMBean persistence -->
      <!-- -->
      <!-- ===================================================================== -->
       <!-- Inline xmbean descriptor
       This is a normal XMBean descriptor, the only different being the
       specification of the DelegatingPersistenceManager as a persistence-manager.
       This persistence manager will invoke a factory operations
       (by default apmCreate()) on an external MBean service
       (by default jboss:service=AttributePersistenceService),
       in order to get a reference to an AttributePersistenceManager
       The actual AttributePersistenceManager implementation is instantiated
       by the AttributePersistenceService and shared by many
       DelegatingPersistenceManagers. By default an XMLAttributePersistenceManager
       is instantiated, but other implementations are possible.
       The external AttributePersistenceService can be use to manage at runtime
       the AttributePersistenceManager implementation, i.e. list persisted ids,
       remove persisted images, or specify a particular 'version-tag' for all
       saved information.
       It is important that the external AttributePersistenceService is
       operational when the XMBean that uses it is instantiated. This will
       normally not be a problem since the AttributePersistenceService is most
       probably started by conf/jboss-service.xml
       <persistence persistPolicy="OnUpdate"/>
       <!-- persistLocation is ignored
       an alternative persistent id may be specified with
       persistName; by default the ObjectName will used -->
       <!-- THIS IS IMPORTANT -->
       <persistence-manager value="org.jboss.mx.persistence.DelegatingPersistenceManager"/>
       <!-- May use a different external AttributePersistenceService; default should be ok.
       <descriptor name="attribute-persistence-service" value="jboss:service=AttributePersistenceService"/>
       <descriptor name="attribute-persistence-operation" value="apmCreate"/>
       <!-- Attributes -->
       <attribute access="read-write" getMethod="getSomeBigDecimal" setMethod="setSomeBigDecimal">
       <attribute access="read-write" getMethod="isSomeBoolean" setMethod="setSomeBoolean">
       <!-- This is an XML element -->
       <attribute access="read-write" getMethod="getSomeElement" setMethod="setSomeElement">
       <!-- We can specify that an attribute is never persisted
       If we remove the "persistPolicy" - "Never" descriptor we'll
       probably get a warning since the java.io.FileDescriptor
       cannot be persisted. Try it! -->
       <attribute access="read-write" getMethod="getSomeFileDescriptor" setMethod="setSomeFileDescriptor">
       <descriptor name="persistPolicy" value="Never"/>
       <!-- primitive types (e.g. int) are boxed during persistence
       (e.g java.lang.Integer) -->
       <attribute access="read-write" getMethod="getSomeInt" setMethod="setSomeInt">
       <attribute access="read-write" getMethod="getSomeInteger" setMethod="setSomeInteger">
       <attribute access="read-write" getMethod="getSomeString" setMethod="setSomeString">
       <attribute access="read-write" getMethod="getSomeTimestamp" setMethod="setSomeTimestamp">
       <descriptor name="currencyTimeLimit" value="10"/>
       <attribute access="read-write" getMethod="getSomeNullObject" setMethod="setSomeNullObject">
       <!-- Again, although the java.util.ArrayList is Serializable,
       it cannot be persisted in this case because it contains
       non-serializable content -->
       <attribute access="read-write" getMethod="getSomeArrayList" setMethod="setSomeArrayList">
       <descriptor name="persistPolicy" value="Never"/>