quartz scheduler: run on last day of the month
Asked Answered
D

1

15

I need to run a job on the last day of every month. i tried the following cron expression:

<property name="cronExpression" value="0 0 3 L * * *" />

but got this error:

Caused by: java.lang.UnsupportedOperationException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.

it doesnt like the L, but without using it, how can i run on the last day of the month?

Drudgery answered 10/2, 2011 at 20:1 Comment(0)
M
29

Just change your trigger to

0 0 3 L * ?

One of day of week or day of month needs to be ?. You cannot specify both.

Masao answered 10/2, 2011 at 20:8 Comment(5)
your expression has 1 less item in in then mine.. this is ok?Drudgery
Yes, that's the year field. It's not mandatory, and if you put *, then it's the same as omitting the value.Masao
I have tried it but not working.It gives error :java.lang.NumberFormatException: For input string: "L"Ezara
@Ezara First, this question is answered and long inactive, better create a new one. Second, be more descriptive about your issues. Third, you seem to be informing 'L' where a number value was expected.Masao
If anyone would wonder 3 in expression then it is time of day. This mean last day of month at 3.00 AM. If you want send explicate time then use this {SEC} {MIN} {HOUR} L * ? e.g. 15 30 3 L * ? it will execute on last day of month at 3.30.15 AMSpiros

© 2022 - 2024 — McMap. All rights reserved.