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?

mdrg
  • 3,242
  • 2
  • 22
  • 44
mkoryak
  • 57,086
  • 61
  • 201
  • 257

1 Answers1

28

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.

mdrg
  • 3,242
  • 2
  • 22
  • 44
  • your expression has 1 less item in in then mine.. this is ok? – mkoryak Feb 10 '11 at 20:14
  • 1
    Yes, that's the year field. It's not mandatory, and if you put `*`, then it's the same as omitting the value. – mdrg Feb 10 '11 at 20:15
  • I have tried it but not working.It gives error :java.lang.NumberFormatException: For input string: "L" – Sheo Aug 22 '12 at 11:11
  • 1
    @Sheo 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. – mdrg Aug 22 '12 at 16:55
  • 1
    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 AM – Ankush Madankar Sep 24 '21 at 11:09