1 Reply Latest reply on Nov 28, 2002 8:00 AM by Andrew Sharpe

    Saving Changes to MBeans

    Andrew Sharpe Newbie

      I am migrating a JBoss 2.4 project to JBoss 3.0.

      I have an application that runs inside JBoss and allows its users to make changes to attributes of JBoss MBeans at runtime. However if they shut down JBoss and restart it, obviously these changes will not be there anymore because the MBean has not persisted itself to the service.xml file.

      My question is how do I tell MBeans to persist themselves? Is it even possible? I have read mention of "persistent mbeans" but can find no documentation on how to create and make them work. Also what is to be done with MBeans that I have not created, such as jboss.jca:service=LocalTxDS,name=DefaultDS? Obviously I cannot make that mbean extend some "persistentmbean" interface, since it is not my mbean. If I modified one of that mbean's attributes at runtime, how could I get this change to persist over re-starts of JBoss?

      I have seen many other posts (arguments?) on this topic but could not find a conclusive answer as to whether or not it can be done. If it is possible and not too complicated, can someone provide a detailed description of how to do it (from start to finish)?

      Our original application found the jcml file on the classpath, loaded it into a DOM, and modified it manually in code. Obviously I'd like to avoid that in JBoss 3,
      especially with things such as embedded mbeans and attributes that return entire DOM Elements.

      My apologies if this is the wrong forum for this question.


        • 1. Re: Saving Changes to MBeans
          Andrew Sharpe Newbie

          Ok so I wrote to the JBoss developers directly to get an answer to this and this was their response:

          David Jencks:
          modelmbean persistence is available in jboss 4 (cvs head). no one has tried to make a significant part of the server configuration persist in this way: the first step is to make all the server mbeans into xmbeans.

          The model mbean persistence might get into 3.2 (it might already have been ported, I'm not sure) but is unlikely to get into 3.0

          Matt Munz implemented it. If you search to dev list for his posts you can find the discussion of this feature.

          I am sorry to disappoint you, but this question still stands. I did not have any time to implement persistence of mbean attributes the way I see it (moreover, it was mentioned that something similar would be present in JBoss 3.2). I still consider this issue to be VERY
          important and will inevitable have it implemented. I can let you know then, or may be we can do it together :-)


          So what I am now doing as a workaround is making a copy of my service.xml file in the conf directory. In order to save my MBean runtime changes, I modify this file manually from code (using DOM) and copy it to the deploy directory on server restart. This way my mbean changes persist, and JBoss doesn't undeploy and redeploy my mbean every time I change its service.xml file.