Java on non-openHABian

I followed the install guide here so if your telling me it needs to be started as unattended the guide needs updating.

I also have issues with samba not working, have not had time to narrow the cause yet but I suspect it may be because there is no openhabian user account created.

Well, I just upgraded to Ubuntu Server 20.04 and I thought I’d try OpenJDK 11
I removed Oracle JDK 8 and installed OpenJDK 11 using apt
I don’t use any of the plug-ins or serial communications.

Openhab started right up and runs like nothing happened. :sunglasses:

1 Like

although this was in the log

smitopher@myth-server:~$ sudo systemctl status openhab2.service
[sudo] password for smitopher:
● openhab2.service - openHAB 2 - empowering the smart home
     Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-06-02 13:50:37 CDT; 1min 5s ago
       Docs: https://www.openhab.org/docs/
             https://community.openhab.org
   Main PID: 1122 (java)
      Tasks: 228 (limit: 9298)
     Memory: 782.0M
     CGroup: /system.slice/openhab2.service
             └─1122 /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 -D>

Jun 02 13:50:37 myth-server systemd[1]: Started openHAB 2 - empowering the smart home.
Jun 02 13:50:41 myth-server karaf[1122]: org.ops4j.pax.url.wrap [org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler for protocols [wrap] started
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release
Jun 02 13:50:59 myth-server karaf[1122]: Warning: Nashorn engine is planned to be removed from a future JDK release

Yes, we need to replace Nashorn at some time. But in Java 11 it‘s only a deprecation warning and everything works as expected.

These are suppressed in 2.5.6-SNAPSHOT after backporting the “fix” from OH3:

On windows 10 I got same error message and it does not matter witch Java version OpenJDK or Zulu I use:

Launching the openHAB runtime...
Listening for transport dt_socket at address: 5005
org.ops4j.pax.url.wrap [org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler for protocols [wrap] started

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.6-SNAPSHOT
                               Build #138

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> Exception in thread "OkHttp Dispatcher" java.lang.IllegalArgumentException: unsupported auth scheme: [Basic realm="gSOAP Web Service"]
        at com.burgstaller.okhttp.digest.DigestAuthenticator.findDigestHeader(DigestAuthenticator.java:199)
        at com.burgstaller.okhttp.digest.DigestAuthenticator.authenticate(DigestAuthenticator.java:164)
        at com.burgstaller.okhttp.CachingAuthenticatorDecorator.authenticate(CachingAuthenticatorDecorator.java:35)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.followUpRequest(RetryAndFollowUpInterceptor.kt:213)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:102)
Exception in thread "OkHttp Dispatcher" Exception in thread "OkHttp Dispatcher"         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at com.burgstaller.okhttp.AuthenticationCacheInterceptor.intercept(AuthenticationCacheInterceptor.java:49)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.lang.IllegalArgumentException: unsupported auth scheme: [Basic realm="gSOAP Web Service"]
        at com.burgstaller.okhttp.digest.DigestAuthenticator.findDigestHeader(DigestAuthenticator.java:199)
        at com.burgstaller.okhttp.digest.DigestAuthenticator.authenticate(DigestAuthenticator.java:164)
        at com.burgstaller.okhttp.CachingAuthenticatorDecorator.authenticate(CachingAuthenticatorDecorator.java:35)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.followUpRequest(RetryAndFollowUpInterceptor.kt:213)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:102)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at com.burgstaller.okhttp.AuthenticationCacheInterceptor.intercept(AuthenticationCacheInterceptor.java:49)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.lang.IllegalArgumentException: unsupported auth scheme: [Basic realm="gSOAP Web Service"]
        at com.burgstaller.okhttp.digest.DigestAuthenticator.findDigestHeader(DigestAuthenticator.java:199)
        at com.burgstaller.okhttp.digest.DigestAuthenticator.authenticate(DigestAuthenticator.java:164)
        at com.burgstaller.okhttp.CachingAuthenticatorDecorator.authenticate(CachingAuthenticatorDecorator.java:35)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.followUpRequest(RetryAndFollowUpInterceptor.kt:213)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:102)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at com.burgstaller.okhttp.AuthenticationCacheInterceptor.intercept(AuthenticationCacheInterceptor.java:49)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jboss.netty.util.internal.ByteBufferUtil (file:/C:/openhab2/userdata/cache/org.eclipse.osgi/275/0/.cp/lib/netty-3.9.0.Final.jar) to method java.nio.DirectByteBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of org.jboss.netty.util.internal.ByteBufferUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Which binding is not working? Unfortunately there is not much in this stack trace. If you can‘t say which binding, please provide a list of all installed bindings and additionally the output of bundle:list -s | grep 275. Thanks.

I sent debug files in a message.

Look like you ran into both problems I mentioned here: Java on non-openHABian

Both are known and workarounds are available. You can use the search on how to install @5iver PR for jython. And I‘m quite sure there is also a thread about updating nrjavaserial. Report back if there are further problems.

It does not work for me.
Now I try to use what was working before trying Java11.
I reverted back everything. Despite of it when I start second time rule enige with org.openhab.core.automation.module.script.rulesupport-2.5.0-SNAPSHOT.jar in addon folder Rule engine gives the following error in the attached file.
ruleengine.log (139.1 KB)

After that I stop OH, delete this file from addon folder. Empty Catch and TMP folders in Userdata.
Than I restart OH twice and activaty my yard.py rules and it loads succefully.
Here is the second log: ruleengine2.log (14.6 KB)

If all you did was remove the jar for the Jython addon and Jython started, then you had Jython configured in your EXTRA_JAVA_OPTS. You can’t have Jython manually installed AND use the Jython addon. I suspect this is the cause of the exceptions.

I do not understand what you mean. C:\openhab2\userdata\tmp and C:\openhab2\userdata\cache folders are containing working information of Openhab. If I empty them Openhab recreate everything from the beginning based on actual set up including Jython I guess. In many cases if I update a binding I have to do that otherwise binding information won’t be refreshed.

If you remove the Jython addon from the /addons/ directory and clear the cache, Jython will not be installed unless you have it also manually installed. Remove any reference from EXTRA_JAVA_OPTS and it should not reappear.

Basically, if you have the Jython addon installed, remove the Jython references from EXTRA_JAVA_OPTS, except possibly python.path, if you need to add other directories for libraries. What do you have in your EXTRA_JAVA_OPTS?

A fellow man of taste and distinction, I see. :smiley:

Absolutely false. Here is the repo:

# Zulu Java (for OpenHAB)
deb http://repos.azulsystems.com/debian stable main

# OpenHAB (Stable) Debian Repo
deb https://dl.bintray.com/openhab/apt-repo2 stable main

I included the OpenHAB repository, too. But this is all right there in Installation Docs.

I am on OpenHAB v2.5.5-1 (stable) on Armbian stable, and followed the recommendation to use Zulu 8 and it has been flawless on my ODRIOD-XU4. But I am conservative by nature. If you are more adventurous, you could perhaps help the project by testing newer versions of Java. :wink:

You did not mention what hardware you are running on, I have an idea because Armbian, however all these people talking about 64-bit but you did not specify that (or I missed it). But for armhf for instance you will want the zulu-embedded-8 package (I found there was no “regular” zulu-8 package for armhf).

(Perhaps I should ad that last little tid-bit to the docs.)

1 Like

Ok. I need to clean these settings. I made several trials and that is the reason. Now Java11 works. I’m working on run OH as a service now under win10 as it does start with start.bat only for some reason. Here is my 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

I donwloaded latest jython-standalone-2.7.2.jar and replaced 2.7.0 but I updated extra java opts, and now 2.7.0 again, that could be one reason?

I’m using armbian as well, I don’t see Java 11:

$ apt-cache search zulu
libreoffice-l10n-zu - office productivity suite -- Zulu language package
hyphen-zu - Zulu hyphenation patterns
libzulucrypt-dev - development files for libzulucrypt-1.2.0
libzulucrypt-exe-dev - development files for the libzulucrypt-exe
libzulucrypt-exe1.2.0 - provide the main functions of zulucrypt
libzulucrypt-plugins - collection of plugins for zulucrypt
libzulucrypt1.2.0 - provide the functions of zulumount
libzulucryptpluginmanager-dev - development files for libzulucryptpluginmanager
libzulucryptpluginmanager1.0.0 - provides support for plugins
zulucrypt-cli - tool for encrypting volumes
zulucrypt-gui - graphical front end for zulucrypt-cli
zulumount-cli - tool that manages encrypted volumes
zulumount-gui - graphical front end for zulumount-cli
zulupolkit - handler the polkit privileges
zulusafe-cli - cli that manages encrypted volumes
zulu-embedded-8 - Azul Systems Zulu Embedded is a binary distribution of OpenJDK

And ever checked what’s in there ?
They abandoned that long ago, somewhere around Java 8u156 if I recall correctly.
So unless they changed anything very recently, my original statement remains true.
It’s why we had to completely rework the openHABian Java install routine to use Azul API now.
Hell, it’s even why we started looking for alternatives and have Adopt now.

3 Likes

Correct, the repo only contains the amd64 binaries and they are up to date but what @mstormi said is very true. I can promise that it uses the API except on amd64 and then it will even fall back to the API if the machine doesn’t meet the requirements.

Look at the code before making assumptions. I wrote the code, it won’t use that repo on ARM.

I managed to run now Java 11 with openHAB 2.5.6 Build #139.
Windows10
openjdk version “11.0.2” 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
I deleted " -Xbootclasspath/a:C:\openhab2\conf\automation\jython\jython-standalone-2.7.2.jar" from EXTRA JAVA OPTS and copied it to
C:\openhab2\runtime\lib\boot\jython-standalone-2.7.2.jar
Now it works and load Python and Java rules.
When I restart Openhab it still not loads rules in C:\openhab2\conf\automation\jsr223
It runs only if I save it again.
If I copy this file to addon folder: org.openhab.core.automation.module.script.rulesupport-2.5.0-SNAPSHOT.jar then I get the following errors and rules are not starting.
ruleengine_debug.log (46.9 KB)

I have found this in wrapper.log

STATUS | wrapper  | 2020/06/11 06:11:01 | Launching a JVM...
INFO   | jvm 5    | 2020/06/11 06:11:01 | WARNING: package org.apache.karaf.specs.locator not in java.base
INFO   | jvm 5    | 2020/06/11 06:11:02 | Error: Could not find or load main class org.apache.karaf.wrapper.internal.service.Main
INFO   | jvm 5    | 2020/06/11 06:11:02 | Caused by: java.lang.NoClassDefFoundError: org/apache/karaf/main/ShutdownCallback
ERROR  | wrapper  | 2020/06/11 06:11:02 | JVM exited while loading the application.
FATAL  | wrapper  | 2020/06/11 06:11:02 | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
FATAL  | wrapper  | 2020/06/11 06:11:02 |   There may be a configuration problem: please check the logs.
STATUS | wrapper  | 2020/06/11 06:11:03 | <-- Wrapper Stopped

Title of thread is “Java on non-openHABian” not “Java 11 on …” so I still don’t understand why everyone keeps talking about Java 11?

Installation docs recommend (Zulu) Java 8 anyway. That’s what I have been on and so far, so good.

@mstormi & @ndye,

I just installed zulu-embedded-8 a few weeks ago on armhf architecture (ODROID-XU4) using apt and the repo I mentioned above. Now, if something changed in more recent versions, I don’t know. But on Azul Java 8 you can definitely install via apt repo:

trs80@odroidxu4:~$ dpkg-query -l *zulu*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name            Version      Architecture Description
+++-===============-============-============-==============================================================
un  zulu-8          <none>       <none>       (no description available)
ii  zulu-embedded-8 8.25.0.76    armhf        Azul Systems Zulu Embedded is a binary distribution of OpenJDK