[solved] JSR-233 groovy SimpleRule subclassing does not work

Using openhabian 1.4 and openhab 2.2, I am currently trying to migrate my openHAB 1.8.x groovy rules.

I found that it is impossible to subclass SimpleRule like that:

import org.eclipse.smarthome.automation.*
import org.eclipse.smarthome.automation.module.script.rulesupport.shared.simple.*
import org.eclipse.smarthome.config.core.Configuration
import org.slf4j.*

def logger = LoggerFactory.getLogger('Holiday.groovy')

class HolidayRule extends SimpleRule {
    Object execute(Action module, Map<String, ?> inputs) {
        logger.warn("Separate class")

def holidayRule1 = new HolidayRule()

This leads to

date/time [ERROR] [.automation.core.internal.RuleEngine] - Failed to execute rule '1612de53-1b98-431b-b826-cf0c5a3051ce': Fail to execute action: 1

Using an anonymous subclass instead works just fine.

What am I missing?

I don’t know if this also affects JSR-233, but unlike openHAB1 imports with wild cards are not allowed in openHAB2 rules.

Hello Udo,
I just replaced the wildcard imports with qualified imports, but the problem remains.

I found the culprit: defining something outside the named class (in my case the logger) was causing the problem.
However, this is no problem when using an anonymous class.