ScheduledExpression: for some wildcard expressions, getting "Fail to parse schedule expression"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ScheduledExpression: for some wildcard expressions, getting "Fail to parse schedule expression"

kerickson
Hello,

I've noticed that scheduled expressions will fail when using wildcards with
a number greater than the maximum unit. For example, if I set a schedule to
run every 60 minutes (as opposed to 59, which works):

        ScheduleExpression expression = new ScheduleExpression();
        expression.minute("*/60");
        return expression;

I then get the error below. To my knowledge, "*/60" is an OK cron
expression, so it should be supported. Please let me know if this is a
valid concern not currently on the radar and I'll file a bug entry for it.
I'm aware that an hourly equivalent would work but I need the number of
minutes to be changeable up to 1400 minutes (one day).

13-May-2019 11:29:35.199 SEVERE [localhost-startStop-1]
org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException
EjbTransactionUtil.handleSystemException: Fail to parse schedule expression
javax.ejb.ScheduleExpression@61f48baf
 java.lang.IllegalArgumentException: Fail to parse schedule expression
javax.ejb.ScheduleExpression@61f48baf
    at
org.apache.openejb.core.timer.CalendarTimerData.initializeTrigger(CalendarTimerData.java:64)
    at org.apache.openejb.core.timer.TimerData.newTimer(TimerData.java:222)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.initializeNewTimer(EjbTimerServiceImpl.java:738)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.createTimer(EjbTimerServiceImpl.java:715)
    at
org.apache.openejb.core.timer.TimerServiceImpl.createCalendarTimer(TimerServiceImpl.java:79)
    at
org.apache.openejb.core.timer.TimerServiceWrapper.createCalendarTimer(TimerServiceWrapper.java:75)
    at
com.omniupdate.ox.workers.PasswordHashExpirer.postConstruct(PasswordHashExpirer.java:36)
        ....
Caused by: ParseException [field=null, value=null, error=null]
    at
org.apache.openejb.core.timer.EJBCronTrigger.<init>(EJBCronTrigger.java:139)
    at
org.apache.openejb.core.timer.CalendarTimerData.initializeTrigger(CalendarTimerData.java:61)
    ... 53 more


Thanks,
-Kean
Reply | Threaded
Open this post in threaded view
|

Re: ScheduledExpression: for some wildcard expressions, getting "Fail to parse schedule expression"

exabrial12
https://docs.oracle.com/javaee/6/api/javax/ejb/ScheduleExpression.html

Unfortunately, not on Java EE it seems. The max is in fact 59. Likely this
is a quirky behavior of crond they didn't want to make portable.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html