2

I am using spring scheduler for executing some task in my application , it is working fine in my local system after building and uploading war file to the server it is not working.

I am using cron expression for executing task at perticular time.

Here is my code... Wheather i missed something??????

@Repository
@EnableScheduling
public class ReportScheduler {

_____________

       @Scheduled(cron="0 23 11 ? * *", zone="Asia/Kolkata")
       public void methodC() throws MasterNotRunningException, ZooKeeperConnectionException, ServiceException, IOException {
        try{
        ___________________

        ________________
        }
        catch(Exception)
        {
            e.printstacktrace();
        }

_____________
}

I want to execute this task everyday morning 1.1AM.

If i test by changing system time in local system it is working fine. After uploading war file it is not working.

Mahabaleshwar
  • 227
  • 1
  • 13
  • Did you checked in in the server environment by changing the server time? -- Have you logged every exception and the invocation of `methodC` ? – Ralph Jan 24 '17 at 06:42
  • Yes, I am setting time zone like this zone="Asia/Kolkata" So it should run some perticular instance it is not executing single time?Please suggest if any mistake is there and i have logged every exception i didnt get any exception. – Mahabaleshwar Jan 24 '17 at 07:10
  • In server 5.30 hours difference is there its using UTC time zone in server – Mahabaleshwar Jan 24 '17 at 07:11
  • Wheather my time zone is wrong? – Mahabaleshwar Jan 24 '17 at 07:13
  • As fare as I know, it is important to manipluate the server time (zone) before you start the application. - More correct: the scheduler use an internal sleep mechanim to wait for the next event. And this sleep is not modified when you change the server clock. – Ralph Jan 24 '17 at 13:08

1 Answers1

0

Your CRON expression missing a space between the 1 and ?. This could block the job being executed.