[SOLVED] Setting JAVA_EXTRA_OPTS for jython changes logging location

Trying to get Jython scripting to work on OH2. Followed the instructions here:

EXTRA_JAVA_OPTS="-Xbootclasspath/a:/usr/local/jython/jython.jar -Dpython.home=/usr/local/jython - Dpython.path=/etc/openhab2/lib/python"

When I put this line in /etc/default/openhab2, the openhab logging stops (except for occasional warnings logging to /var/log/syslog). Why is that? I know it has to do with the Xbootclasspath. If I leave that one out, it works. Is there a way this can be fixed? Here are the arguments with which java is running:

openhab  24399     1 10 20:07 ?        00:00:32 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Djava.library.path=/var/lib/openhab2/tmp/lib -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Xbootclasspath/a:/usr/local/jython/jython.jar -Dpython.home=/usr/local/jython -Dpython.path=/etc/openhab2/lib/python --add-reads=java.xml=java.logging --patch-module java.base=lib/endorsed/org.apache.karaf.specs.locator-4.2.1.jar --patch-module java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-4.2.1.jar --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dkaraf.instances=/var/lib/openhab2/tmp/instances -Dkaraf.home=/usr/share/openhab2/runtime -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/var/lib/openhab2/etc -Dkaraf.logs=/var/log/openhab2 -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/lib/boot/activation-1.1.1.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-api-2.3.0.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-core-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-impl-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main
  • Platform information:
    • Hardware: Virtual machine (shouldn’t matter)
    • OS: Ubuntu 18.04
    • Java Runtime Environment: java 11.0.1+13 2018-10-16 LTS
    • openHAB version: 2.4.0-1

Could somebody please help? I don’t know how to find the log files. They are not in any standard place, if it’s logging at all.

Thanks!

This is what happens when you run Java 11 instead of Java 8.

@Benjy or @wborn , could one of you please provide some specifics on the issue with Jython and Java 11? I have not tested this yet to see it first hand, and I’d like to make a note of it in openhab2-jython. Thank you!

Their issue tracker contains some issues about this, e.g.: https://bugs.jython.org/issue2362

1 Like

I found 3 total for JDK9. 2 are related, very much edge cases, have a workaround, and resolved in Jython 2.7.2. The other looks like a minimal slowdown in startup. Did you see others? IMO, these should not effect OH, or be a cause of the issue the OP reported.

I got around to testing Jython 2.7.1.patch2618 and OpenJDK11. The service would report status, but there was nothing showing up in the logs, so I assumed OH was not running. I didn’t see anything like this in their bug tracker, but there’s something definitely there. When I find some time, I’ll look at this some more, and start with start.sh.