3 Replies Latest reply on Dec 5, 2003 9:42 AM by Alan McDade

    How do I Init an MBean

    Alan McDade Newbie

      I have created a class that extends ServiceMBeanSupport called ConfigFileWatcher and its associated interface ConfigFileWatcherMBean interface that extends ServiceMBean.

      Then I created the sar file and copied it to the deploy directory.

      However whenever JBoss tries to start the MBean I get the following exception

      org.jboss.deployment.DeploymentException: create operation failed for package file:/C:/JBoss/jboss-3.2.2/server/mindhouse/deploy
      /Config-File_Watcher.sar/; - nested throwable: (org.jboss.deployment.DeploymentException: timer.ConfigFileWatcher.(); - ne
      sted throwable: (java.lang.NoSuchMethodException: timer.ConfigFileWatcher.()))
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:202)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:786)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:641)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      Caused by: org.jboss.deployment.DeploymentException: timer.ConfigFileWatcher.(); - nested throwable: (java.lang.NoSuchMeth
      odException: timer.ConfigFileWatcher.())
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:143)
      at org.jboss.system.ServiceController.install(ServiceController.java:225)
      at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy4.install(Unknown Source)
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:183)
      ... 15 more
      Caused by: java.lang.NoSuchMethodException: timer.ConfigFileWatcher.()
      at java.lang.Class.getConstructor0(Class.java:1929)
      at java.lang.Class.getConstructor(Class.java:1019)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:846)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:291)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:318)
      at org.jboss.system.ServiceCreator.install(ServiceCreator.java:98)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:155)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
      ... 24 more

      As I do not have an init method declared and I cannot find any mention of one in the documentation can anyone tell me what is going on ?

      Thanx in advance

        • 1. Re: How do I Init an MBean
          Alan McDade Newbie

          Sorry the must be a constructor call. May code includes constructors what else do I need to do...

          /*
          * Created on 01-Dec-2003
          */
          package timer;


          /**
          * @author amcdade
          */
          public class ConfigFileWatcher extends org.jboss.system.ServiceMBeanSupport {
          ///////////////////////////////////////////////////////////////
          // Constructors
          ///////////////////////////////////////////////////////////////
          public ConfigFileWatcher(){
          super();
          }

          public ConfigFileWatcher(String propertiesFilename){
          super();

          this.propertiesFilename = propertiesFilename;
          }

          ///////////////////////////////////////////////////////////////
          // ConfigFileWatcher specific code.
          ///////////////////////////////////////////////////////////////
          private String propertiesFilename = "";

          /**
          * @return
          */
          public String getPropertiesFilename() {
          return propertiesFilename;
          }

          /**
          * @param string
          */
          public void setPropertiesFilename(String string) {
          propertiesFilename = string;
          }

          ///////////////////////////////////////////////////////////////
          // Jboss jmx specific code.
          ///////////////////////////////////////////////////////////////
          /**
          * @see org.jboss.system.ServiceMBean#getName()
          */
          public String getName() {
          return ConfigFileWatcher.class.getName();
          }


          /**
          * @see org.jboss.system.ServiceMBeanSupport#startService()
          */
          protected void startService() throws Exception {
          super.startService();
          }

          /**
          * @see org.jboss.system.ServiceMBeanSupport#stopService()
          */
          protected void stopService() throws Exception {
          super.stopService();
          }

          }


          /*
          * Created on 03-Dec-2003
          */
          package timer;

          import org.jboss.system.ServiceMBean;

          /**
          * @author amcdade
          */
          public interface ConfigFileWatcherMBean extends ServiceMBean{

          public String getPropertiesFilename();
          public void setPropertiesFilename(String filename);
          }

          • 2. Re: How do I Init an MBean
            Andrew Boyd Novice

            Are you still having the problem? When I had this problem making my constructor public fixed it.

            • 3. Re: How do I Init an MBean
              Alan McDade Newbie

              Thanks the problem was name collision. There was a ConfigFileWatcher already on the system