[Windows] All OH logs stop when Jython is in the classpath

Tags: #<Tag:0x00007faecba435b8>

Hi,

Congratulations to all the developers on Openhab, I have been experimenting with it over the past few months. It is very addictive. Unfortunately I have run into an issue I cannot resolve.

  • Platform information:
    • Hardware: Intel Core i3, 8GB Memory, Intel NUC
    • OS: Windows 10
    • Java Runtime Environment: Zulu8.25.0.3 (I tried a 32 and 64 bit version also)
    • openHAB version: 2.5 M2 New ‘standard’ install. No binding, things etc…
  • Installed: Experimental rule engine

I’ve attempted to install jython scripting so I can write my rules in Python. I followed these two guides here:

https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Installation.html

and:

However, as soon as I place the jython-standalone .jar file in conf\automation\jython and restart Openhab all logging stops. For example when I log:tail in the console I get nothing.

If I delete the jython-standalone .jar file and restart Openhab again, log:tail produces all the usual output. It also shows all the ServiceEvents REGISTERED of all the .py files etc… But when I save a .py file it of course says ScriptEngine for py not available

Maybe surprisingly Openhab seems to be running ok, even when I get no logs. The various interfaces all work, and sensor data seems to come through. So it would seem that only the logging is broken.

In the userdata\logs folder I do not see the timestamp updated either. The timestamp stays the same as the last time Openhab ran.

I have tried:

  • restoring the log config file org.ops4j.pax.logging.cfg on my ‘production’ version of Openhab (I saw this on some other threads)
  • deleting tmp, cache folders at various stages
  • a completely empty ‘standard’ fresh install using 2.5 M2 version (only with experimental rule engine installed)
  • setting EXTRA_JAVA_OPTS as env variable, and in the start.bat file:

-Xbootclasspath/a:D:\OpenHAB\openHAB_2-5_M2\conf\automation\jython\jython-standalone-2.7.1.jar -Dpython.home=D:\OpenHAB\openHAB_2-5_M2\conf\automation\jython -Dpython.path=D:\OpenHAB\openHAB_2-5_M2\conf\automation\lib\python

  • Tried jython 2.7.0, 2.7.1

Unfortunately without the logs, finding the problem becomes rather difficult.

Has anyone come across this before? If you have any other ideas I would love to hear them, as I have run out! :laughing:

Many thanks!

2.5M2 is the new TESTING version. The STABLE version is 2.4.
I know there are a couple of expected problems with the current test version.
I do not recall hearing anything script related either way.

This was the first thing that came to mind…

But when I observed this, the logs were working. I haven’t tested on a Windows install in a couple months, so this could be something new. I’ll boot over to Windows and take a look sometime later today.

Are you missing the set EXTRA_JAVA_OPTS= from the beginning of this line? From the docs…

REM Add to the top of the file
set EXTRA_JAVA_OPTS=-Xbootclasspath/a:C:\openhab2\conf\automation\jython\jython-standalone-2.7.0.jar -Dpython.home=C:\openhab2\conf\automation\jython -Dpython.path=C:\openhab2\conf\automation\lib\python

Thanks for the replies…

@Bruce_Osborne I will try with 2.4 again. I can’t recall why I moved to 2.5. I think because of a particular binding I needed. But worth a try again.

@5iver The path I posted was just the value of the environment variable I set. So yes has that EXTRA_JAVA_OPTS as the variable name. Thanks for the ticket will take a look…

I tried the same setup with 2.4, and it works. So must be something with 2.5

I think I moved to 2.5 because I use a Conbee2 dongle, and there were some issues on 2.4 with the deconz binding I read here:

I’ll try some things, see if I can work it out…

I finally booted into Windows and was amazed that I could reproduce this. However, by fiddling around and restarting OH a bunch of times, the logs worked again. I’ll look into it some more and open an issue if I can’t figure out the cause/fix.

Cool at least it wasn’t just my setup. I’ll try some rounds of restarting…

Thanks so much for looking into it.

1 Like

@gjj81 I am having the same issues as you.

https://community.openhab.org/t/jsr223-jython-breaks-karaf-or-logging/80351

Any luck with fiddling around with things or trying multiple restarts of OH? I have had no luck. For me I went to OH2.5 so that I wouldn’t have to change setenv.bat, and I’d be in the correct future configuration for the start.bat file. (See this post from @5iver).

https://community.openhab.org/t/windows-using-extra-java-opts/75624

I’d rather not go back to 2.4 because I already reconfigured my rules for the new mail binding which seemed to replace the mail action in 2.5. But, I can if I have to.

Another option would be to run in a Linux VirtualBox VM with a bridged NIC. That is how I started evaluating OH.

@Bruce_Osborne, I’ve considered this, but this is only my test box, I mess around with the new stuff when I’m on the road. My actual home setup is a linux NAS that I built. It works great and once stuff is running smooth on windows I port it over to that box. Not ideal probably, but hadn’t had a problem like this until now.

One more update, just for kicks I went in and actually edited the setenv.bat file, and as I expected it didn’t change the result. I’m pretty sure that I’m actually getting the environment set up correctly, and that there is an underlying error that’s causing the logging break. Just like @gjj81, if I look through my logfiles, there are no updates whatsoever while this error is in effect. Only ERROR level logs print out on the Karaf console in real time, and their formatting is all wrong, but don’t get logged to files.