Finding source of this error? "[ERROR] [org.quartz.core.JobRunShell"

Occasionally seeing this error in the logger. Any ideas on how to find the source?

2018-09-27 08:54:32.398 [ERROR] [org.quartz.core.JobRunShell         ] - Job DEFAULT.2018-09-27T08:54:32.388-05:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {

  <XFeatureCallImplCustom>.postUpdate(<XFeatureCallImplCustom>)

  <XFeatureCallImplCustom>.put(<XMemberFeatureCallImplCustom>,<XNullLiteralImplCustom>)

} ] threw an unhandled Exception: 

java.lang.NullPointerException: null

	at org.eclipse.smarthome.model.script.engine.ScriptError.<init>(ScriptError.java:66) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:132) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1115) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1045) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:143) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:763) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:219) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) [156:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]

	at com.sun.proxy.$Proxy169.apply(Unknown Source) [?:?]

	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) [137:org.eclipse.smarthome.model.script:0.10.0.oh230]

	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh230]

	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh230]

I think there is something wrong with the cron triggering. Di you have rule that are cron triggered or do you use timers?

I have one rule that uses cron triggering - based on the time of day pattern.

Maybe it is worth posting it so that we may find an error. If in understand correct the expection thrown is a null Pointer

Here is the rule using cron…


rule "Calculate time of day state"
when
    Time cron "0 * * * * ? *"
then
    val String curr_time = now.toString("HH:mm")
    val String night_start = "00:00"
    val String morning_start = "06:00"
    val String day_start = (VT_Sunrise_Time.state as DateTimeType).format("%1$tH:%1$tM")
    val String evening_start = (VT_Sunset_Time.state as DateTimeType).format("%1$tH:%1$tM")
    val String midnight_time = "24:00"

    var new_val = "UNKNOWN"
    var new_daylight = OFF

    switch true {
        case night_start <= curr_time && curr_time < morning_start:   new_val = "NIGHT"
        case morning_start <= curr_time && curr_time < day_start:     new_val = "MORNING"
        case day_start <= curr_time && curr_time < evening_start:     new_val = "DAY"
        case evening_start <= curr_time && curr_time < midnight_time: new_val = "EVENING"
    }
//  logInfo("Time_Of_Day", "curr_time=" + curr_time + ", night_start=" + night_start + ", morning_start=" + morning_start
//      + ", day_start=" + day_start + ", evening_start=" + evening_start + ", midnight_time=" + midnight_time
//      + ", new_val=" + new_val)

    if (VT_TimeOfDay.state.toString != new_val) {
        logInfo("Time_Of_Day", "Current time of day is now " + new_val)
        VT_TimeOfDay.sendCommand(new_val)
    }

    if (curr_time > day_start && curr_time < evening_start)
      new_daylight = ON
    else
      new_daylight = OFF
    
    if (VT_DayLight_Switch.state != new_daylight)
      VT_DayLight_Switch.sendCommand (new_daylight)
end

There is an exception being thrown from one of your Timer bodies.

Check all your Timer bodies for potential errors. The most common error is assuming an Item has a non-NULL state.

Ok, so its possible that one of the items may not have been initialized and that might cause the error?

Without actually seeing any code all I can suggest what is most common. It is usually good practice to account for Items having a NULL state in your Rules anyway rather than just assume every Item has a valid state. Then you can actually use the NULL state in meaningful ways, for example, to short circuit a Rule instead of running the Rule on old sensor readings when a sensor fails for some reason (NOTE: I’m not saying that NULL should be used to detect said failure, just as an indication that the Item doesn’t have a usable state).

But when you for example

if(MyItem.state as Number < 25)

and MyItem.state == NULL then you will get an exception, usually a null exception, because the result of the attempt of the underlying Rules DSL to cast the NULL to a Number returned null.

I experienced this error in a timer rule with a simple change of the syntax this error is now gone :slight_smile:

OLD (simplyfied)

myTimer = createTimer(now.plusMinutes(15), [ | // actions )]

NEW comma replaced by moved “)”

myTimer = createTimer(now.plusMinutes(15)) [ | // actions ]

In some examples and the one I found the old variation of the timer syntax is used.

See also

You are right; objective of this timer was to see if an external API was running. In all my wisdom the timer was activated by two fields of this API, and these arrived in a pair each time; this caused unpredictable behaviour. So now monitoring only one field (I also moved the Timer var outside the rule as global, seems it is working as intended).

Likely I jumped to wrong conclusions because two other problems

  1. Editing a timer rule can/will dump (and might require a reboot). Thanks for this info!

  2. An URI ERROR dump; appearing the first time VSCode with OpenHab extension is opened. I was able to solve this myself see post.

Becauce I already reduced my logging to almost zero these dumps did not fall of my screen anymore and came under my intention; Think I will also toggle inside the logging settings for the rule info.

BTW both timer syntax seems to be correctly working.

Thanks again for your comments.

Confusing with be my epitath

There is no functional difference between the two syntax. Essentially the Rules parser will replace the myTimer = createTimer(now.plusMinutes(15)) [ | // actions ] with myTimer = createTimer(now.plusMinutes(15), [ | // actions ]) automatically.

1 Like

What does the | stand for?
I just recognized that i sometimes use it and sometimes not without seeing a difference!?

to be honest I get inspired by examples and use the syntax as available as you see this was explained by rlkoshak.

Thanks - same with me :wink:

However both of your syntax’ have the “|” and both seem to work on my side.
Your difference was the )

Anyway, as long as both work - I am fine (but just curios ;-))
Thanks again for your response

The “pipe” symbol | is a separator between the arguments passed to the lambda and the code. When you do not have any arguments, the | is optional.

All right, thanks Rich.
that make sense