Hi,
i have installed jsr233 with jython. Works perfekt and very fast!
But i have a problem. During startup of obenhab the .jy scripts will be loaded and executed before any other configuration-files are loaded (like items and other rules). Then the py script fails to init, because i use a CommandEventTrigger Listener. The item of the listener could not be found at this moment, so the scipt will not work, even if openhab is completly started. If i touch the script after openhab is completly started, my script works.
How can i get this working after a restart?
Therre is anouter topic without answer: jsr223: Delayed loading after startup
Thank you and greetings
Dennis
2016-02-08 18:08:27.061 [INFO ] [o.c.j.i.e.scriptmanager.Script] - Loading Script rollaeden.py
2016-02-08 18:08:36.427 [INFO ] [o.c.j.i.e.scriptmanager.Script] - EngineName: jython
2016-02-08 18:08:39.443 [ERROR] [o.o.c.j.i.e.s.ScriptManager ] - script exception javax.script.ScriptException: org.openhab.core.items.ItemNotFoundException:
org.openhab.core.items.ItemNotFoundException: Item 'RollaedenAlle' could not be
found in the item registry in script at line number 117
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
~[jython.jar:na]
at org.python.jsr223.PyScriptEngine.invokeFunction(PyScriptEngine.java:132)
~[jython.jar:na]
at
org.openhab.core.jsr223.internal.engine.scriptmanager.Script.loadScript(Script.java:93)
~[bundlefile:na]
at
org.openhab.core.jsr223.internal.engine.scriptmanager.Script.(Script.java:79)
~[bundlefile:na]
at
org.openhab.core.jsr223.internal.engine.scriptmanager.ScriptManager.loadScript(ScriptManager.java:90)
[bundlefile:na]
at
org.openhab.core.jsr223.internal.engine.scriptmanager.ScriptManager.loadScripts(ScriptManager.java:79)
[bundlefile:na]
at
org.openhab.core.jsr223.internal.engine.scriptmanager.ScriptManager.(ScriptManager.java:68)
[bundlefile:na]
at
org.openhab.core.jsr223.internal.engine.Jsr223Engine.activate(Jsr223Engine.java:71)
[bundlefile:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
at
org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:235)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
[org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at
org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
[org.eclipse.equinox.util_1.0.400.v20120917-192807.jar:na]
Caused by: org.python.core.PyException: null
at org.python.core.Py.JavaError(Py.java:546) ~[jython.jar:na]
at org.python.core.Py.JavaError(Py.java:537) ~[jython.jar:na]
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
~[jython.jar:na]
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
~[jython.jar:na]
at org.python.core.PyObject.__call__(PyObject.java:478) ~[jython.jar:na]
at org.python.core.PyObject.__call__(PyObject.java:482) ~[jython.jar:na]
at org.python.core.PyMethod.__call__(PyMethod.java:141) ~[jython.jar:na]
at org.python.pycode._pyx0.__init__$12(:104) ~[na:na]
at org.python.pycode._pyx0.call_function() ~[na:na]
at org.python.core.PyTableCode.call(PyTableCode.java:167) ~[jython.jar:na]
at org.python.core.PyBaseCode.call(PyBaseCode.java:307) ~[jython.jar:na]
at org.python.core.PyBaseCode.call(PyBaseCode.java:198) ~[jython.jar:na]
at org.python.core.PyFunction.__call__(PyFunction.java:482) ~[jython.jar:na]
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
~[jython.jar:na]
at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[jython.jar:na]
at org.python.core.PyMethod.__call__(PyMethod.java:223) ~[jython.jar:na]
at org.python.core.Deriveds.dispatch__init__(Deriveds.java:19) ~[jython.jar:na]
at org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java:1112)
~[jython.jar:na]
at org.python.core.PyType.type___call__(PyType.java:1713) ~[jython.jar:na]
at org.python.core.PyType.__call__(PyType.java:1696) ~[jython.jar:na]
at org.python.core.PyObject.__call__(PyObject.java:461) ~[jython.jar:na]
at org.python.core.PyObject.__call__(PyObject.java:465) ~[jython.jar:na]
at org.python.pycode._pyx0.getRules$15(:117) ~[na:na]
at org.python.pycode._pyx0.call_function() ~[na:na]
at org.python.core.PyTableCode.call(PyTableCode.java:167) ~[jython.jar:na]
at org.python.core.PyBaseCode.call(PyBaseCode.java:307) ~[jython.jar:na]
at org.python.core.PyFunction.function___call__(PyFunction.java:471) ~[jython.jar:na]
at org.python.core.PyFunction.__call__(PyFunction.java:466) ~[jython.jar:na]
at org.python.core.PyFunction.__call__(PyFunction.java:456) ~[jython.jar:na]
at org.python.core.PyFunction.__call__(PyFunction.java:451) ~[jython.jar:na]
at org.python.jsr223.PyScriptEngine.invokeFunction(PyScriptEngine.java:126)
~[jython.jar:na]
... 21 common frames omitted
Caused by: org.openhab.core.items.ItemNotFoundException: Item 'RollaedenAlle' could
not be found in the item registry
at
org.openhab.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:80)
~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
~[jython.jar:na]
... 49 common frames omitted