openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.69k forks source link

[ERROR] An unexpected exception has occured #1742

Closed kfiasche closed 8 years ago

kfiasche commented 9 years ago

2014-11-26 15:32:56.302 [ERROR] [.o.m.c.i.folder.FolderObserver] - An unexpected exception has occured java.lang.NullPointerException: null at org.openhab.model.rule.internal.engine.RuleEngine.runStartupRules(RuleEngine.java:263) ~[na:na] at org.openhab.model.rule.internal.engine.RuleEngine.modelChanged(RuleEngine.java:243) ~[na:na] at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:158) ~[na:na] at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:99) ~[na:na] at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) ~[na:na] at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) ~[na:na]

dominicdesu commented 9 years ago

Do you have more information? Which version of openHab are you running? When did this error occur? How can this error be reproduced?

svdgouw commented 9 years ago

Same problem, following the instructions to setup the demo of http://www.openhab.org/gettingstarted.html Using current version 1.6.1 on Windows 8.1 (64b). Initially with JDK1.8.0_20, but also tried JDK1.7.0_67 (both 32b and 64b).

svdgouw commented 9 years ago

Problem seems to be caused/triggered by rule "Persistence Demo 2" in the demo.rules file. Removing this rule at least gets rid of the NPE every couple of seconds :-)

dougmeredith commented 9 years ago

I am also encountering this problem. It is easily reproduced on both Linux and Windows. I'm using 1.6.1 and Java 1.7.0_71. Unzip the runtime and demo zips, create the config file by making a copy of the default config, and start the runtime using the supplied script. The error occurs after about 25 seconds and repeats every 10 seconds or so.

Deleting "Persistence Demo 2" did not eliminate the NullPointerException for me.

dominicdesu commented 9 years ago

Can you set the logging level to debug and upload or post the complete server log? (using e.g. pastebin.com)

dominicdesu commented 9 years ago

Problem could be in ScriptImpl.execute(), in which a ScriptExecutionException is created without a cause (Throwable). This might lead to the NullPointerException in RuleEngine.runStartupRules(), where it tries to access the cause message.

dougmeredith commented 9 years ago

Here is the requested debug log. http://pastebin.com/Pf4Tpt69

The exception first occurs at 9:39:11.961. I see there is an earlier ClassCastException. This doesn't show up when not running in debug mode.

dominicdesu commented 9 years ago

Hello, thank you for the debug log. The ClassCastException is fine, this is a known issue with the atmosphere library. I have modified the RuleEngine class and added additional logging output. Could somebody replace the following jar from openhab/server/plugins/org.openhab.model.rule_1.6.1.jar on his openHAB server, start the server with logging set to debug and post the results again? Here is the modified jar with additional logging output: https://www.dropbox.com/s/3clt74ah2svslqx/org.openhab.model.rule-1.6.1.jar?dl=0

dougmeredith commented 9 years ago

Here is the debug log with the new jar. http://pastebin.com/z3UFgdnu

dominicdesu commented 9 years ago

Hi, thanks for the fast reply and the debug log. First, here is a workaround for openHAB 1.6.1: Try removing the logInfo line from the rule "Update max and min temperatures" or replace it with something like this:

logInfo("Weather","Temperature changed from " + Weather_Temperature.historicState(now.minusMinutes(2)) + " to " + Weather_Temperature.state + " degrees.")

In the 1.7.0 snapshot, the related issue #1752 has been fixed with pull request #1753. I cannot reproduce the above mentioned error, but instead another (more obvious) error message is displayed at startup:

2014-12-30 01:29:59.909 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Update max and min temperatures': cannot invoke m
ethod public java.lang.String org.openhab.core.library.types.DecimalType.toString() on null

It is obvious that a Temperature for now - 2 minutes doesn't exist when openHAB has just been started, however this should not be displayed as an ERROR message in the log as it is an expected state.

dougmeredith commented 9 years ago

I can confirm that your workaround eliminates the problem for me using 1.6.1. Thanks for your efforts. Now I can continue with my evaluation of OpenHAB. I just discovered the project, and I have high hopes for it.

ChrisPlontzke commented 9 years ago

Hello, unfortunately I lately also get this error all 10secs and can´t get rid of it . Neither disabling Persistence Demo 2 nor disabling any logInfo could help.

Is there another solution ?

thanks, Chris. Openhab 1.6.1, Rasp Wheezy,

steve-bate commented 8 years ago

@dougmeredith, can this issue be closed?

dougmeredith commented 8 years ago

I just tried the demo with a fresh install of 1.7.1, and the issue still seems to be there.

2015-12-27 23:44:12.622 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize light states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null 2015-12-27 23:44:12.705 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize heating states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null 2015-12-27 23:44:12.787 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize contact states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null

steve-bate commented 8 years ago

Only critical bug fixes will be made to the openHAB 1 core, designer tools and user interfaces since core development is focussed on openHAB 2.