0 Replies Latest reply on Dec 19, 2006 5:42 AM by Niklas Saers

    NoSuchMethodError when calling from a Schedulable

    Niklas Saers Newbie

      Hello,
      I've made a ScheduleService that implements Schedulable and to start with I want it to be my cron-substitute. The function I call is:

      public String importCSV(int limit) {
      importCSV i = new importCSV();
      i.importFromDB(limit);
      return "OK";
      }

      where importCSV is found through

      import saers.util.*;

      importCSV.importFromDB() is defined as:
      public void importFromDB(int limit)

      I've set up an mbean for SchedulerService and one based on org.jboss.varia.scheduler.Scheduler. When it is called I get the exception listed under in the logs. The main problem seems to be:

      Caused by: java.lang.NoSuchMethodError: saers.util.importCSV.importFromDB(I)V

      but as I mentioned, it is already defined:
      public void importFromDB(int limit)

      so that seems correct, it takes an integer and returns void. Why am I getting a NoSuchMethodError??

      Here is the complete log:

      2006-12-19 11:29:03,009 DEBUG [org.jboss.varia.scheduler.Scheduler$Listener] MBeanListener.handleNotification(), notification: javax.management.timer.TimerNotification[source=jboss:service=Timer][type=Schedule][message=Scheduler Notification]
      2006-12-19 11:29:03,010 DEBUG [org.jboss.varia.scheduler.Scheduler$Listener] Scheduler is started: true
      2006-12-19 11:29:03,010 DEBUG [org.jboss.varia.scheduler.Scheduler$Listener] MBean Arguments are: []
      2006-12-19 11:29:03,010 DEBUG [org.jboss.varia.scheduler.Scheduler$Listener] MBean Arguments Types are: []
      11:29:03,040 ERROR [Scheduler$Listener] Invoke of the Schedulable MBean failed
      javax.management.RuntimeErrorException
      at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:178)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:163)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.varia.scheduler.Scheduler$MBeanListener.handleNotification(Scheduler.java:1346)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
      at $Proxy10.handleNotification(Unknown Source)
      at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221)
      at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184)
      at javax.management.timer.Timer.sendNotification(Timer.java:1295)
      at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
      at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
      Caused by: java.lang.NoSuchMethodError: saers.util.importCSV.importFromDB(I)V
      at saers.scheduler.SchedulerService.importCSV(SchedulerService.java:53)
      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:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ... 17 more
      2006-12-19 11:29:03,040 ERROR [org.jboss.varia.scheduler.Scheduler$Listener] Invoke of the Schedulable MBean failed
      javax.management.RuntimeErrorException
      at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:178)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:163)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.varia.scheduler.Scheduler$MBeanListener.handleNotification(Scheduler.java:1346)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
      at $Proxy10.handleNotification(Unknown Source)
      at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221)
      at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184)
      at javax.management.timer.Timer.sendNotification(Timer.java:1295)
      at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
      at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
      Caused by: java.lang.NoSuchMethodError: saers.util.importCSV.importFromDB(I)V
      at saers.scheduler.SchedulerService.importCSV(SchedulerService.java:53)
      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:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ... 17 more


      Cheers

      Nik