Hello!
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"
  |    "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd";>
  | <!-- $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
  |       implementation.
  |       
  |       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
  |       -->
  |       <mbean>
  |          <description>PersistentServiceExample</description>
  |          <descriptors>
  |             <persistence persistPolicy="OnUpdate"/>
  |                     <!-- persistLocation is ignored
  |                     
  |                          persistName="PersistentServiceExample"
  |                          
  |                          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"/>
  |             -->
  |          </descriptors>
  |          
<class>org.jboss.jmx.examples.persistence.PersistentServiceExample</class>
  |          
  |          <!-- Attributes -->
  |          
  |          <attribute access="read-write" getMethod="getSomeBigDecimal" 
setMethod="setSomeBigDecimal">
  |             <name>SomeBigDecimal</name>
  |             <type>java.math.BigDecimal</type>
  |          </attribute>
  |          
  |          <attribute access="read-write" getMethod="isSomeBoolean" 
setMethod="setSomeBoolean">
  |             <name>SomeBoolean</name>
  |             <type>boolean</type>
  |          </attribute>
  |          
  |          <!-- This is an XML element -->
  |          <attribute access="read-write" getMethod="getSomeElement" 
setMethod="setSomeElement">
  |             <name>SomeElement</name>
  |             <type>org.w3c.dom.Element</type>
  |          </attribute>
  |          
  |          <!-- 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">
  |             <name>SomeFileDescriptor</name>
  |             <type>java.io.FileDescriptor</type>
  |             <descriptors>
  |                <descriptor name="persistPolicy" value="Never"/>
  |             </descriptors>           
  |          </attribute>
  |          
  |          <!-- primitive types (e.g. int) are boxed during persistence 
  |               (e.g java.lang.Integer) -->
  |          <attribute access="read-write" getMethod="getSomeInt" 
setMethod="setSomeInt">
  |             <name>SomeInt</name>
  |             <type>int</type>
  |          </attribute>
  |          
  |          <attribute access="read-write" getMethod="getSomeInteger" 
setMethod="setSomeInteger">
  |             <name>SomeInteger</name>
  |             <type>java.lang.Integer</type>
  |          </attribute>
  |    
  |          <attribute access="read-write" getMethod="getSomeString" 
setMethod="setSomeString">
  |             <name>SomeString</name>
  |             <type>java.lang.String</type>
  |          </attribute>
  |          
  |          <attribute access="read-write" getMethod="getSomeTimestamp" 
setMethod="setSomeTimestamp">
  |             <name>SomeTimestamp</name>
  |             <type>java.sql.Timestamp</type>
  |             <descriptors>
  |                <descriptor name="currencyTimeLimit" value="10"/>
  |             </descriptors>                
  |          </attribute>
  |          
  |          <attribute access="read-write" getMethod="getSomeNullObject" 
setMethod="setSomeNullObject">
  |             <name>SomeNullObject</name>
  |             <type>java.lang.Object</type>
  |          </attribute>
  |          
  |          <!-- 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">
  |             <name>SomeArrayList</name>
  |             <type>java.util.ArrayList</type>
  |             <descriptors>
  |                <descriptor name="persistPolicy" value="Never"/>
  |             </descriptors>               
  |          </attribute>
  |          
  |       </mbean>
  |        
  |    
  | 
  |       
  | 
  | 
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256944#4256944

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256944
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to