0

I have a problem while getting the instance for Quartz Scheduler, not at the first call but on the continuous calls.

This is my piece of code.

    public void getClusteredSchedulerInstance() {
    try {
        cluteredScheduler = new StdSchedulerFactory("scheduler.properties").getScheduler();
        if (!cluteredScheduler.isStarted()) {
            cluteredScheduler.start();
        }
    } catch (SchedulerException e) {
        logger.error("Error while starting clustered scheduler", e);
    }
}

When i call the method for the first time it reads the property file and gives the instance, but fails to do so on further calls.

Can i know why this happens?

Note: scheduler.properties is located in the current working directory.

Error message

org.quartz.SchedulerException: Properties file: 'scheduler.properties' could not be read. [See nested exception: java.io.FileNotFoundException: scheduler.properties (The system cannot find the file specified)]

kavin
  • 174
  • 2
  • 11
  • I looked into StdSchedulerFactory (Quartz 2.2.1) and did see a reason that would explain the behavior you experience. Basically StdSchedulerFactory first attempts to load your scheduler.properties as a resource from the classpath and if that fails, it attempts to load your scheduler.properties as a file. If that fails too, you get the error. You will have to put a breakpoint in StdSchedulerFactory and debug your application to see what is happening. – Jan Moravec Jun 05 '14 at 08:19
  • Can you show us the Quartz property file please ? – Kraiss Aug 14 '14 at 14:16

0 Answers0