Lots of Java errors after clearing cache on 5.1

Dear All, my long running OpenHab instance started to misbehave a bit after upgrading to latest 5.1 .
E.g., functions in one or more .rules file would just not load at all.
So I decided to clear the cache and restart the instance. Upon restart I see A TON of Java errors in openhab.log

The errors look like this:

[ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.2.3.2.0.4.1.0.2.1.0.0.6::0::/1' failed.
java.lang.NullPointerException: Cannot read field "actionServices" because the return value of "org.openhab.core.model.script.ScriptServiceUtil.getInstance()" is null
        at org.openhab.core.model.script.ScriptServiceUtil.getActionServices(ScriptServiceUtil.java:123) ~[?:?]
        at org.openhab.core.model.script.scoping.ActionClassLoader.loadClass(ActionClassLoader.java:36) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:534) ~[?:?]
        at java.lang.Class.forName(Class.java:513) ~[?:?]

Update: errors only show up after the first start of OpenHab following cache clear operation.Tried restarting again and the errors went away.

Thanks,

Vadim

This is likely due to a change where certain types of errors that used to only be logged became “real” errors in 5.1. That change has been backed out and OH will go back to the previous behavior where the rule will still be used instead of rejected. I’m pretty sure it’s backported but don’t know if it’s been released yet in the latest patch.

In the meantime, make sure to provide a type for arguments passed to lambdas.

This is to be expected. All that clearing the cache does is force openHAB to reinstall all the add-ons. After clearing the cache, on that first boot that means none of the add-ons are installed and available. Due to the parallel way that OH starts up, that means it’s likely that OH will try to initialize or use something before that add-on is reinstalled, resulting in an error.

It is for now a best practice to wait for OH to settle after that first boot and then restart OH. Only really pay attention to the errors in the logs on that second boot.

Also, because this is all that clearing the cache does, the class of problems where it’s an appropriate step to take is limited to add-on problems(e.g. an add-on is not installing correctly or otherwise not comming online). It’s not helpful for anything else.

1 Like

Thank you for clarifying this.