4 Replies Latest reply on Aug 8, 2005 6:14 PM by Elias Ross

    [noob] JMX for remote configuration?

    darren hartford Expert

      Hey all,
      I plead ignorance to JMX, but it seems like this may be the right place to ask.

      Is JMX the proper technology to allow for remote configuration of services? For example, the mail-service.xml seems to tie to an MBean...but in the jboss JMX-Console, most of those properties are read-only per my doubt.

      I'm looking for a standard (well, at least close as possible) way to remotely configure application changes and wondering if JMX would be the best way to go...

      thanks,
      -D

        • 1. Re: [noob] JMX for remote configuration?
          Elias Ross Master


          Yes JMX is the way to go. It so happens that the mail service has its properties read-only, but that's because of how it was written. Take a look at the code in CVS for MailService.java.

          • 2. Re: [noob] JMX for remote configuration?
            darren hartford Expert

            Hmm...I created a JMX MBean (using xdoclet) and everything seems good. However, when trying to use managed properties, on a server reboot those properties are not persisted.

            In my ignorance, what have I missed to be able to remotely configure and persist the configuration (properties/service.xml file) of services for my application?

            Thanks, still figuring this out....

            -D


            /**
             * @author dhartford
             * @jmx.mbean
             * name="atest:service=TestService"
             * extends="org.jboss.system.ServiceMBean"
             * @jboss.service servicefile="jboss"
             */
            public class TestService extends ServiceMBeanSupport implements TestServiceMBean {
            
             public TestService() {
             }
            
            
             private String whoami;
            
             /** @jmx.managed-operation
             *
             * @return The string response of helloWorld()
             * @throws Exception
             */
             public String helloWorld() throws Exception {
             return "Hello from JMX!";
             }
            
             /** @jmx.managed-operation
             *
             * @return The string response of helloWorld()
             * @throws Exception
             */
             public String helloUser() throws Exception {
             return "Hello " + whoami + " from JMX!";
             }
            
             /** @jmx.managed-attribute
             *
             * @return The string response of helloWorld()
             * @throws Exception
             */
             public String getWhoami() throws Exception {
             return whoami;
             }
            
             /** @jmx.managed-attribute
             *
             * @return The string response of helloWorld()
             * @throws Exception
             */
             public void setWhoami(String whoamistring) throws Exception {
             this.whoami = whoamistring;
             }
            }


            • 3. Re: [noob] JMX for remote configuration?
              darren hartford Expert

              I'm not liking this so far...I can read and write to a property file - if I do it programatilly in the MBean code but not via any other means.

              I'm also concerned about how configurations are handled in Jboss - mail-service.xml is a managed resource, but so is hsql-ds.xml -- so why are they so different file-wise and mbean-wise?

              If you had to change the server location of either the mail service or the database service, should it be so different?

              -D

              • 4. Re: [noob] JMX for remote configuration?
                Elias Ross Master


                dhartford, start a new thread for a new topic. This is called "thread hijacking"