[SOLVED] Error during the execution of rule 'Set random image URLs' every 10 seconds in log viewer

  • Platform information:
    • Hardware: RPI3
    • Openhab2
  • Issue of the topic: Openhab logviewer gives an error every 10 seconds with message:

    2019-02-05 08:22:10.029 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule [Set random image URLs’: cannot invoke method public int java.util.Random.nextInt(int) on null]

    How can i get rid of this / how can i fix it / what is it related to?

Post the rule so we can all figure it out

I am new to this. How can I retrieve the ExecuteRuleJob in order to post it?

Could it be related to this demo rule:

rule “Set random image URLs”
Time cron “/10 * * * * ?”
val url = urlList.get(random.nextInt(urlList.length))
val res = resList.get(random.nextInt(resList.length))

postUpdate(ImageURL, url + "/" + res)


What are “urlList” and “resList” on your System? Global variables of the rule-file containing the posted rule? Are they set to anything, or not even declared (what would be an explanation for the error, the cron Statement for every 10 seconds Points there as well).
Do you actually need that rule? If not, delete it and the error is gone!

Just post the entire rule so we can see what’s going on

This was the entire rule. Have deleted it and indeed errors do not appear in logfile anymore. Still no clue what this particular rule generated in demo environment for Openhab though.

In this case it was the reference to variables that haven’t ben declared.
Please mark the thread as resolved.

How do i mark thread as resolved?

You as the author can select the “checkmark” on one reply (one of the icons in the lower line on each reply) to indicate where the solution was posted (it can be a post from yourself!) or you just edit the title of the initial post and put “[Solved]” in front of the actual text.

@PieterTje as @opus mentioned click the post that provided the solution using the square box like in the example below.


I’ll take care of editing the title for you.


1 Like


You can also click the heart icon located to the right of the square box to give any post a like. It’s a great way to say thanks.:wink: