openHAB 2.3.0 rules not working

I realized that my rules are no longer working - no matter if they are triggered either by cron or by an item update. I found the following error messages in the log:

2018-08-20 13:19:45.581 [ERROR] [eclipse.smarthome.model.rule.runtime] - [org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl(177)] The activate method has thrown an exception

java.lang.LinkageError: loader constraint violation: when resolving interface method “org.quartz.Scheduler.setJobFactory(Lorg/quartz/spi/JobFactory;)V” the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the current class, org/eclipse/smarthome/model/rule/runtime/internal/engine/RuleTriggerManager, and the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for the method’s defining class, org/quartz/Scheduler, have different Class objects for the type org/quartz/spi/JobFactory used in the signature

What happened here? How can I fix it? Thanks a lot!

  • Platform information:
    • Hardware: Rasperry Pi 2B
    • OS: Openhabian
    • Java Runtime Environment:
    • openHAB version: 2.3.0

This has happened to several including myself lately. Clean the cache and tmp folders. You can use this line of you like:

sudo service openhab2 stop && sudo rm -rf /var/lib/openhab2/cache/* && sudo rm -rf /var/lib/openhab2/tmp/* && sudo reboot

You may also want to make a backup if you haven’t already. Here is a quick way to make and restore a backup.

Make a Backup

openhab-cli backup

Move the backup zip file to PC or other device.

To restore the backup:

Place the backup zip file into the backups folder

sudo systemctl stop openhab2.service

openhab-cli restore /path/to/zipped/backup (var/lib/openhab2/backups)

sudo systemctl start openhab2.service

Unfortunately this does not help in my case… I just tried it twice and the exception messages still appear on startup! Any hints?

Seem the last line of the log may indicate an issue with something in an items, rules, things, etc… Can you post the items, rules, etc… maybe someone can identify what needs to be changed, adjusted, or added to get your rules working again.

Sorry guys, no idea what the issue was! I did a clean install, restored the backup and everything works now - except that my rule is not working as expected.

import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*

rule "Update Homematic item"
when
	Item WeatherInformation_Today_MaxTemp received update
then
	var Number Max

	if (WeatherInformation_Today_MaxTemp.state instanceof DecimalType) {
		Max = (WeatherInformation_Today_MaxTemp.state as DecimalType)
		logInfo("Foo", "Source WeatherInformation_Today_MaxTemp has value {}", WeatherInformation_Today_MaxTemp.state)
		sendCommand(HM_Vorhersage_Maximaltemperatur, Max)
		logInfo("Foo", "Homematic values successfully updated with value {}", Max)
	} else {
		logError("Foo", "Tried to update HM_Vorhersage_Maximaltemperatur, but source value was not of DecimalType!")
	}

end

What’s the type of the Temperature variable in openHAB? Obviously it’s not an instance of DecimalType since the else-clause is always executed.
And what about the import statements? Wildcards are deprecated, what’s the workaround here?

Thank you so much!! Your help is really appreciated!

We need to work harder. No Java, Perl, Python, Groovy, Scala user has to do this often. We must accept, something is wrong wt rules. A lot of human energy is being wasted in false hopes pursuing this language. This user has wiped cache, re-installed everything, still no luck. Helping on case by case basis is not the solution. Does any user ask Java question here? Of course not. We need to work harder.

2 Likes

um, it’s YOUR item, not OpenHABs. How did you define it ? I’m guessing it could be a String, if it’s extracted from a weather service?

You don’t want those imports in OH 2.3.0 - they could be a source of error

1 Like

No time for a cup of coffee, gotta work harder.:smiley:

2 Likes

Thanks for your hint! It was just a Number item. Slowly starting to see through… :wink:

I just removed the imports and it still works. Good to know! :+1:

Gents, I switched on openhab after half a year of summer sleep.
For whatever reason the rule that I want to run does not work anylonger. I gon’t get a “rule saved” log entry when saving the rule, nothing. It does not trigger, nothing.

Any idea what that could be or how I could debug better? Thanks a lot in advance! :slight_smile:

I suppose the first thing you might do is determine what version of openHAB you are running. 2.3.0 like this old thread?

Where are you expecting to see that?

Guessing you might be talking about some xxx.rules file, you could look in openhab.log for a “Loading model xxx.rules” message.

Hi rossko,

thanks for your quick help! A cleaning of the cache and a reboot solved the problem, as always :wink: sorry for stealing your time :wink:

Cheers