1 Reply Latest reply on Dec 2, 2009 12:04 PM by Katja Koltsova

    MBean with Scheduler: IllegalArgumentException

    Katja Koltsova Newbie

      Hello,

      I want to create a MBean or stateless SessionBean, what has an method that should be called periodical e.g. every 10 second. I founded an example with modifying of scheduler-service.xml and created an interface and a MBean.

      @Local
      public interface TestExampleMBean extends ServiceMBean {
      
       public void hitTest(int param);
      
      }

      @Stateless
      public class TestExample extends ServiceMBeanSupport implements TestExampleMBean {
      
       public TestExample() {
       super();
       }
      
       public void hitTest(int param) {
       log.info("hitTest");
       }
      
       //..other methodes
      }
      

      scheduler-service.xml has following code
      <mbean code="cosee.reporting.service.example.TestExample"
       name=":name=TestExample">
       </mbean>
      
       <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=Scheduler,name=TestExample">
      
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableMBean">:name=TestExample</attribute>
       <attribute name="SchedulableMBeanMethod">hitTest(int)</attribute>
      
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">10000</attribute>
       <attribute name="InitialRepetitions">3</attribute>
       <attribute name="FixedRate">true</attribute>
       </mbean>


      I deploy my application and while scheduling calls of the method IllegalArgumentException is being thrown every time.
      I checked the parameter, the parameter types should be correct.
      Stake trace looks so:
      14:37:03,102 ERROR [Scheduler$BaseListener] Invoke failed for :name=TestExample hitTest
      javax.management.ReflectionException
       at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:189)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:165)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.varia.scheduler.Scheduler$MBeanListener.invoke(Scheduler.java:1316)
       at org.jboss.varia.scheduler.Scheduler$BaseListener.handleNotification(Scheduler.java:1235)
       at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
       at $Proxy215.handleNotification(Unknown Source)
       at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257)
       at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322)
       at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307)
       at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229)
       at org.jboss.mx.timer.JBossTimer.sendNotifications(JBossTimer.java:500)
       at org.jboss.mx.timer.JBossTimer.access$100(JBossTimer.java:63)
       at org.jboss.mx.timer.JBossTimer$RegisteredNotification.doRun(JBossTimer.java:662)
       at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:181)
       at org.jboss.util.timeout.TimeoutFactory$TimeoutTargetImpl.timedOut(TimeoutFactory.java:299)
       at org.jboss.util.timeout.TimeoutFactory$TimeoutWorker.run(TimeoutFactory.java:271)
       at org.jboss.util.threadpool.RunnableTaskWrapper.run(RunnableTaskWrapper.java:147)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       ... 25 more


      I don't really know, what I do wrong.
      Thanks for your help
      myklynysh