1 Reply Latest reply on Apr 11, 2004 1:41 PM by Adrian Wilford

    Problem in running a Schedulable MBean

    osoe Newbie

      I am trying to make a Schedulable MBean to work. Here are my two classes

      import java.util.Date;
      import javax.management.Notification;
      import javax.management.ObjectName;
      import org.jboss.system.ServiceMBean;
      
      
      public interface SchedulableMBean extends ServiceMBean {
       public abstract void hit(
       Notification notification,
       Date date,
       long l,
       ObjectName objectname,
       String s);
      
       public abstract int getHitCount();
      
      }
      

      Second Class
      import java.util.Date;
      import javax.management.Notification;
      import javax.management.ObjectName;
      import org.jboss.system.ServiceMBeanSupport;
      
      public class MailSchedulerMBeanService extends ServiceMBeanSupport implements SchedulableMBean {
       private int hitCount;
      
       public MailSchedulerMBeanService(){
       hitCount = 0;
       }
       /* (non-Javadoc)
       * @see org.ifmc.mail.scheduler.SchedulableMBean#hit(javax.management.Notification, java.util.Date, long, javax.management.ObjectName, java.lang.String)
       */
       public void hit(Notification notification, Date date, long l, ObjectName objectname, String s) {
       log.info("got hit, notification: " + notification + ", date: " + date + ", remaining repetitions: " + l + ", scheduler name: " + objectname + ", test string: " + s);
       hitCount++;
      
       }
      
       /* (non-Javadoc)
       * @see org.ifmc.mail.scheduler.SchedulableMBean#getHitCount()
       */
       public int getHitCount() {
       return hitCount;
       }
      
      }

      XML File : jboss-service.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- $Id: scheduler-service.xml,v 1.4.2.2 2003/10/13 12:31:03 starksm Exp $ -->
      
      <server>
      
       <!-- ==================================================================== -->
       <!-- Scheduler MBean Service Template -->
       <!-- ==================================================================== -->
      
      
       <mbean code="org.ifmc.mail.scheduler.MailSchedulerMBeanService"
       name=":name=TEST MBean MAIL Scheduler ">
       </mbean>
       <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=Scheduler,name=MailSchedulerMBeanService">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableMBean">:name=MailSchedulerMBeanService</attribute>
       <attribute name="SchedulableMBeanMethod">hit( NOTIFICATION, DATE, REPETITIONS, SCHEDULER_NAME, java.lang.String )</attribute>
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">10000</attribute>
       <attribute name="InitialRepetitions">10</attribute>
       </mbean>
      
      
      
       </server>
      
      


      When I deploy the SAR I get
      Caused by: org.jboss.deployment.DeploymentException: Class does not expose a management interface: org.ifmc.mail.scheduler.MailSchedulerMBeanService; - nested throwable: (javax.management.NotCompliantMBeanException: Class does not expose a management interface: org.ifmc.mail.scheduler.MailSchedulerMBeanService)
       at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:139)
       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


      Thanks for your help