0 Replies Latest reply on Feb 9, 2006 6:00 AM by chaitanya

    problem while running scheduler task

    chaitanya Novice

      i have written DBTest scheduler class and copied into scheduler-plugin.jar;but when i run the server i am getting the below exception;
      i want to run the DBTest class for evry 60 seconds..i confgured DBTest in schedular-service.xml;

      schedular-service.xml
      *********************


      true
      org.jboss.varia.scheduler.example.DBTest
      DBTest Testtttttttt,12345
      java.lang.String,int
      NOW
      60000
      -1



      DBTest
      ***********


      package org.jboss.varia.scheduler.example;
      import java.util.Date;
      import org.jboss.varia.scheduler.Schedulable;
      import java.sql.*;

      import org.apache.log4j.Logger;

      public class DBTest implements Schedulable
      {
      private static final Logger log = Logger.getLogger(DBTest.class);

      private String name;
      private long value;

      public DBTest(String name, long value)
      {
      this.name = name;
      this.value = value;
      log.info("ctor, name: " + name + ", value: " + value);
      }

      public void perform(Date now, long remainingRepetitions)
      {
      log.info("perform, now: " + now +
      ", remainingRepetitions: " + remainingRepetitions +
      ", name: " + name + ", value: " + value);
      try
      {
      Class.forName("xx.xx.x.xx");
      Connection con= DriverManager.getConnection("jdbc:oracle:thin:@xxxxx:xxx:xxx","xxxx","xxx");



      }catch(Exception e)
      {
      e.printStackTrace();
      }
      }
      }


      2006-02-09 16:28:15,301 ERROR [org.jboss.varia.scheduler.Scheduler] Could not find the constructor or create Schedulable instance
      java.lang.NoSuchMethodException: org.jboss.varia.scheduler.example.DBTest.(java.lang.String, int)
      at java.lang.Class.getConstructor0(Class.java:1937)
      at java.lang.Class.getConstructor(Class.java:1027)
      at org.jboss.varia.scheduler.Scheduler.startSchedule(Scheduler.java:294)
      at org.jboss.varia.scheduler.Scheduler.startService(Scheduler.java:1157)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)