Trying to get jsr223 / jython working with no success

i’m working on a raspberry pi 2, with everything installed via apt-get (including jsr223 and jython). i have the script engine in the logs saying jython is available and saying it’s loading my rule (the test rule from the wiki), but then it just stops and doesn’t reload again until i restart the server. i’m stumped and haven’t been able to figure out anything from searching…can anyone help me out? i have no idea where to go from here and i’m about ready to say to hell with it and just go back to xtend…

i have turned debug logging on and don’t see anything in the logs as to what is going on after it tries to load my rule script, it just dies quietly it seems.

1 Like

i’m making progress…i guess? now when i restart openhab, it loads the script over and over and over and over a bunch of times until it then gives up and hangs like i described above. this is maddening, especially since i’m apparently the only person who has ever had this issue…please, help! below is the message that is repeated about 15-20 times before everything hangs up and crashes as described in my first message. i can’t for the life of me figure out how to get this working…

2016-07-26 21:24:44.729 [INFO ] [o.o.c.j.i.e.s.ScriptManager ] - Available engines:
2016-07-26 21:24:44.782 [INFO ] [o.o.c.j.i.e.s.ScriptManager ] - jython
2016-07-26 21:24:45.628 [INFO ] [o.o.c.j.i.e.s.ScriptManager ] - Rhino
2016-07-26 21:24:45.641 [INFO ] [o.c.j.i.e.scriptmanager.Script] - Loading Script

Please make sure you change enough in your script file.
Sometimes a newline helps.

Are all four messages repeating or just the “Loading” message?

i’ve been changing it more than just a new line…trying different rules from the wiki.

all four are repeating each time.

What happens if you have a single script file with only the following code?

def getRules():
    return RuleSet([])

same thing. that was one of the examples i’ve tried.

If you are seeing the “Available engines:” log line multiple times, it sounds like the bundle is being reloaded repeatedly. I’ve never heard of anyone else having that issue, especially with no other error-level log messages.

indeed, which is why this is so frustrating. i haven’t been able to find anything even remotely resembling this in my searches…

any idea where to start looking to try to resolve this? i’d really like to migrate to jsr223 because xtend isn’t really as fast as i’d like on the pi2…

Unfortunately, I don’t have any suggestions. If it happened to me I’d run the setup in an Eclipse debugger and see what’s triggering the reload (breakpoint in the bundle activate method, for example), but I understand you may not be set up for that.

i’ve also tried all the suggestions here: Installing jython for JSR233 - update on wiki

no luck on anything. can anyone help? this is maddening…how the hell am i the only one who has ever had this issue?

can you give us the whole log file, the directory structure of openhab (can be obtained by using find) and the content of your scripts?

what commands do i run to get the directory structure? i installed everything via apt-get, if that helps any…

here’s the part of the log file that shows the repeating script manager. the log with debug turned on is literally tens of thousands of lines, i’d be more than happy to get it to you but i don’t see any way to attach a file and copy/paste is not an option if i want to avoid crashing my computer.

as for the full text of my script, as i’ve said i have tried multiple variations of the wiki, including a completely blank file with only this in it and still had the exact same issue…

def getRules():
    return RuleSet([])

i got it working! the key (at least for me) was to install jython from the download, and then follow the wiki for an apt-get install (only changed JAVA_ARGS in /etc/default/openhab). with the version of jython installed from the web, it seems to be working now…

and what exactly is the difference to your previous setup?

as i said, the only thing i did differently was to install jython from the web download instead of apt-get, and then following this part of the wiki:

To use Jython, update JAVA_ARGS in /etc/default/openhab to this

JAVA_ARGS="-Xbootclasspath/a:/opt/jython/jython.jar -Dpython.home=/opt/jython -Dpytho

also, not sure if this will help anyone else but i’ll throw it out there just in case - i was getting an error on trying to install jython from the web download. i finally figured out that for some reason java apparently didn’t like the dashes in the file name… once i changed the filename from jython-installer-2.7.0.jar to jythoninstaller.jar, it worked perfectly.