openHAB 5.x-SNAPSHOT requires Java 21

Hi everybody,
this is to make you aware that we have already switched the OH 5.0.0 snapshot builds to Java 21.
Starting tomorrow, you will need Java 21 to run openHAB 5.

Please keep in mind that we will also switch to 64 bit for OH5 and stop creating 32-bit images etc.
See the release note of OH 4.3 for more information.

And as every time when we release a new stable version: If your are in the middle of developing a PR, also keep in mind to rebase to our latest commit on the main branch.
Thanks!

8 Likes

I still have questions on this. I expect to still be fixing things in 4.3 addons. So far, one would mostly be able to use the new snapshot compiled jar in the previous release version of the software when manually installing.
Does this mean if I use the standard development setup my compiled addon jars will not work in the previous version? How do I make sure they do work in the 5.0.0 snapshot as well as in the 4.3 release core?

1 Like

For us (developers), I assume we need to have both Java 17 and Java 21 JDK installed on dev PC. We can then switch between Java 17 and Java 21 JDK depending on if we want to build a jar to be used in 4.3.x or 5.0.

Deploying a 5.0.0-SNAPSHOT binding to 4.3 release instance can be done (as long as there are not breaking API changes) as follows:

You need a Java 21 compiler, no need for a Java 17 compiler.

  1. Run your 4.3 instance on Java 21. OH 4.3 perfectly runs on Java 21 as well. openHABian-config can be used to switch to Java 21 on RPI. Keep in mind that the future-proof setup is a 64-bit system, at some point in time a binding might require a 64-bit system. OH5 bindings compiled for Java 21 can be deployed just as usual.
    or
  2. Keep your 4.3 instance running on Java 17. Use Java 21 to compile your binding, but generate Java 17 code. We have a profile j17 in place in the addons repo to do this without modifying the pom file: mvn install -Pj17 -Dohc.version=4.3.0. This will only work for bindings which do not require specific Java 21 libraries or features. Same remark as above: Keep in mind that the future-proof setup is a 64-bit system, at some point in time a binding might require a 64-bit system. IDEs might need some tweaking, otherwise you might end up with some Java 21 classes in the target folder.

tl;dr:
Run openHAB 4.3 on a 64-bit system with Java 21 if you want to use 5.0.0-SNAPSHOT bindings.

4 Likes

The Docker images are now updated for this and OH5 seems to start. :whale:
Let us know if something is broken due to Java 21!

2 Likes

Iā€™m probably not doing this correct (many errors). I did mvn clean install with Java 21, then ran mvn install -Pj17 Iā€™m using windows 11 with github desktop. Also have been going directly to the binding folder to compile C:\Users\Robert\GitHub\openhab-addons\bundles\org.openhab.binding.mideaac>mvn install -Pj17
Do I need to switch java versions for this work? Partial log

[ERROR]         mvn:org.ow2.asm/asm/9.7
[ERROR]         mvn:org.threeten/threeten-extra/1.8.0
[ERROR]         mvn:org.yaml/snakeyaml/2.2
[ERROR]         mvn:si.uom/si-quantity/2.1
[ERROR]         mvn:tech.units/indriya/2.2
[ERROR]         mvn:tech.uom.lib/uom-lib-common/2.2
[ERROR] }
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

C:\Users\Robert\GitHub\openhab-addons\bundles\org.openhab.binding.mideaac>java -version
java version "21.0.4" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 21.0.4+8-LTS-274)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.4+8-LTS-274, mixed mode, sharing)

Did you rebase?

Does it mean that Java 21 is not considered experimental or untested anymore for 4.3?

For me it seems to be stable. I have been running Java 21 on my dev setup an did not encounter any problems. The last Java17/21 issue I can think of was the persistence issue due to the UTF8 character in date strings - which has been dealt with months ago. Our unit tests and integration tests also work well.

Cannot tell how many people use Java 21, but I think it is fine to do so. I have not seen bug reports.

1 Like

Iā€™ve updated both my 4.3 instances to Java 21 a couple of days ago and have seen nothing unexpected.

I did yesterday, but Iā€™m not at the computer right now. Iā€™m up to 2 commits that talk about oh 5. I did create a jar that works on the OH5 snapshot . Will check

Edit I have up to your #17910 PR. I donā€™t have 17914, is that related?

donā€™t know if this helps, but it appears to choke at the karaf 4.4.6 verify when I add -Pj17.
build logs.txt (2.4 KB)

@apella12 Could you try if adding ** -Dohc.version=4.3.0 -Pj17 ** resolves this problem?

That worked to compile :smile: Thanks

Iā€™ll still have to test if the jar works in my OH4.3 instance. Will post update when I get that done. A little busy right now

Edit: Also confirm the compiled jar works with OH4.3 and Java 17. All good.

1 Like

I can confirm this was the missing piece. I was able to build an OH 5.0.0 snapshot binding and run it on OH 4.3 and Java 17.

1 Like

i have massive issues with docker and the 5.0 snapshot.
My logs are getting flooded and in portainer OH is stuck ā€œstartingā€.
If i filter the log for ā€œerrorā€ i get this:

2025-01-02 22:58:59.981 [ERROR] [xtext.validation.CompositeEValidator] - Error executing EValidator

2025-01-02 22:59:00.236 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment ā€˜|::0.2.0.2.0.0.0::0::/1ā€™ failed.

2025-01-02 22:59:00.476 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment ā€˜|::0.2.0.2.0.0.0::0::/1ā€™ failed.

2025-01-02 22:59:12.475 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment ā€˜|::0.2.0.2.0.0.0.6.6::0::/1ā€™ failed.

the rest looks like this:

                      JvmField: Tmp_TVRules.Hobby_Helligkeit (visibility: PRIVATE, simpleName: Hobby_Helligkeit, identifier: Tmp_TVRules.Hobby_Helligkeit, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> NumberItem
                      JvmField: Tmp_TVRules.SprinklerZone3 (visibility: PRIVATE, simpleName: SprinklerZone3, identifier: Tmp_TVRules.SprinklerZone3, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> GroupItem
                      JvmField: Tmp_TVRules.Arbeitszimmer_Echo_Volume (visibility: PRIVATE, simpleName: Arbeitszimmer_Echo_Volume, identifier: Tmp_TVRules.Arbeitszimmer_Echo_Volume, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> DimmerItem
                      JvmField: Tmp_TVRules.SprinklerZone4 (visibility: PRIVATE, simpleName: SprinklerZone4, identifier: Tmp_TVRules.SprinklerZone4, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> GroupItem
                      JvmField: Tmp_TVRules.SprinklerZone1 (visibility: PRIVATE, simpleName: SprinklerZone1, identifier: Tmp_TVRules.SprinklerZone1, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> GroupItem
                      JvmField: Tmp_TVRules.Arbeitszimmer_Nanoleaf_Power (visibility: PRIVATE, simpleName: Arbeitszimmer_Nanoleaf_Power, identifier: Tmp_TVRules.Arbeitszimmer_Nanoleaf_Power, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> SwitchItem
                      JvmField: Tmp_TVRules.SprinklerForecastDay3Wind (visibility: PRIVATE, simpleName: SprinklerForecastDay3Wind, identifier: Tmp_TVRules.SprinklerForecastDay3Wind, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> NumberItem
                      JvmField: Tmp_TVRules.SprinklerZone2 (visibility: PRIVATE, simpleName: SprinklerZone2, identifier: Tmp_TVRules.SprinklerZone2, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> GroupItem
                      JvmField: Tmp_TVRules.OG_Flur_Fenster_Kontakt (visibility: PRIVATE, simpleName: OG_Flur_Fenster_Kontakt, identifier: Tmp_TVRules.OG_Flur_Fenster_Kontakt, deprecated: <unset>) (static: true, final: false, volatile: false, transient: false, constant: <unset>, constantValue: null) -> ContactItem
                      JvmField: Tmp_TVRules.WP_Warmwasser_Isttemperatur (visibility: PRIVATE, simpleName: WP_Warmwasser_Isttemperatur, identifier: Tmp_TVRules.WP_Warmwasser_Isttemperatur, deprecated: <unset>) (static: true, final: false, volatile: false

@holgerf I think many of the develops are facing this issue (supporting OH 4.3 while moving on with 5.0).

Wouldnā€™t it make sense to create a step-by-step install guide to have a ā€œbi-lingualā€ setup for Dev. purposes

  • which Eclipse version
  • what to add/update
  • P17 install, options to add
  • build process to create both versions

This would be really appreciated.

I tried to update openHAB to 5.x via openhabian but it fails to install java 21:

sudo apt-get install --yes -o DPkg::Lock::Timeout= -t unstable openjdk-21-jre-headless
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libc-bin : Depends: libc6 (< 2.32) but 2.41-2 is to be installed
 libc-dev-bin : Depends: libc6 (< 2.32) but 2.41-2 is to be installed
 libc6 : Breaks: systemd (< 256~rc4-1~)
         Breaks: systemd:armhf (< 256~rc4-1~)
         Breaks: libc6:armhf (!= 2.41-2) but 2.31-13+rpt2+rpi1+deb11u11 is to be installed
 libc6:armhf : Breaks: libc6 (!= 2.31-13+rpt2+rpi1+deb11u11) but 2.41-2 is to be installed
 libc6-dbg : Depends: libc6 (= 2.31-13+rpt2+rpi1+deb11u11) but 2.41-2 is to be installed
 libc6-dev : Depends: libc6 (= 2.31-13+rpt2+rpi1+deb11u11) but 2.41-2 is to be installed
 libsystemd-shared : Depends: libssl3t64 (>= 3.4.0) but it is not going to be installed
 locales : Depends: libc-bin (> 2.41)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

when I do

apt --fix-broken install

it tells me

The following packages will be REMOVED:
  build-essential dbus-user-session dconf-gsettings-backend dconf-service deconz:armhf g++ g++-10 glib-networking glib-networking:armhf gsettings-desktop-schemas init libatk-bridge2.0-0:armhf libatk1.0-0:armhf libatomic1:armhf libatspi2.0-0:armhf libavahi-client3:armhf
  libavahi-common3:armhf libblkid1:armhf libbluetooth-dev libbrotli1:armhf libbsd0:armhf libc-bin libc-dev-bin libc6:armhf libc6-dbg libc6-dev libcairo-gobject2:armhf libcairo2:armhf libcolord2:armhf libcom-err2:armhf libcrypt1:armhf libcups2:armhf libdatrie1:armhf libdbus-1-3:armhf
  libdeflate0:armhf libdouble-conversion3:armhf libdrm-amdgpu1:armhf libdrm-nouveau2:armhf libdrm-radeon1:armhf libdrm2:armhf libedit2:armhf libegl-mesa0:armhf libegl1:armhf libelf1:armhf libepoxy0:armhf libevdev2:armhf libexpat1:armhf libexpat1-dev libffi7:armhf libfontconfig1:armhf
  libfreetype-dev libfreetype6:armhf libfreetype6-dev libfribidi0:armhf libgbm1:armhf libgcc-s1:armhf libgcrypt20:armhf libgdk-pixbuf-2.0-0:armhf libgl1:armhf libgl1-mesa-dri:armhf libglapi-mesa:armhf libgles2:armhf libglib2.0-0:armhf libglvnd0:armhf libglx-mesa0:armhf libglx0:armhf
  libgmp10:armhf libgnutls30:armhf libgpg-error0:armhf libgraphite2-3:armhf libgssapi-krb5-2:armhf libgtk-3-0 libgtk-3-0:armhf libgtk-3-bin libgtk-3-common libgudev-1.0-0:armhf libharfbuzz0b:armhf libhogweed6:armhf libice6:armhf libicu67:armhf libidn2-0:armhf libinput10:armhf
  libjbig0:armhf libjpeg62-turbo:armhf libjson-glib-1.0-0:armhf libk5crypto3:armhf libkeyutils1:armhf libkrb5-3:armhf libkrb5support0:armhf liblcms2-2:armhf libllvm11:armhf liblz4-1:armhf liblzma5:armhf libmd0:armhf libmd4c0:armhf libmount1:armhf libmtdev1:armhf libnettle8:armhf
  libnsl2:armhf libnss-nis:armhf libnss-nisplus:armhf libp11-kit0:armhf libpam-systemd libpango-1.0-0:armhf libpangocairo-1.0-0:armhf libpangoft2-1.0-0:armhf libpcre2-16-0:armhf libpcre2-8-0:armhf libpcre3:armhf libpixman-1-0:armhf libpng-dev libpng16-16:armhf libproxy1v5:armhf
  libpsl5:armhf libpython3-dev libpython3.9-dev libqt5core5a:armhf libqt5dbus5:armhf libqt5gui5:armhf libqt5network5:armhf libqt5qml5:armhf libqt5serialport5:armhf libqt5sql5:armhf libqt5sql5-sqlite:armhf libqt5svg5:armhf libqt5websockets5:armhf libqt5widgets5:armhf librest-0.7-0
  librest-0.7-0:armhf librsvg2-2:armhf librsvg2-common:armhf libselinux1:armhf libsensors5:armhf libsm6:armhf libsoup-gnome2.4-1 libsoup-gnome2.4-1:armhf libsoup2.4-1 libsoup2.4-1:armhf libsqlite3-0:armhf libssl1.1:armhf libstdc++-10-dev libstdc++6:armhf libsystemd-shared
  libsystemd0:armhf libtasn1-6:armhf libthai0:armhf libtiff5:armhf libtinfo6:armhf libtirpc3:armhf libudev1:armhf libunistring2:armhf libuuid1:armhf libvulkan1:armhf libwacom2:armhf libwayland-client0:armhf libwayland-cursor0:armhf libwayland-egl1:armhf libwayland-server0:armhf
  libwebp6:armhf libx11-6:armhf libx11-xcb1:armhf libxau6:armhf libxcb-dri2-0:armhf libxcb-dri3-0:armhf libxcb-glx0:armhf libxcb-icccm4:armhf libxcb-image0:armhf libxcb-keysyms1:armhf libxcb-present0:armhf libxcb-randr0:armhf libxcb-render-util0:armhf libxcb-render0:armhf
  libxcb-shape0:armhf libxcb-shm0:armhf libxcb-sync1:armhf libxcb-util1:armhf libxcb-xfixes0:armhf libxcb-xinerama0:armhf libxcb-xinput0:armhf libxcb-xkb1:armhf libxcb1:armhf libxcomposite1:armhf libxcursor1:armhf libxdamage1:armhf libxdmcp6:armhf libxext6:armhf libxfixes3:armhf
  libxi6:armhf libxinerama1:armhf libxkbcommon-x11-0:armhf libxkbcommon0:armhf libxml2:armhf libxrandr2:armhf libxrender1:armhf libxshmfence1:armhf libxxf86vm1:armhf libz3-4:armhf libzstd1:armhf locales lsof:armhf mesa-vulkan-drivers:armhf modemmanager network-manager packagekit
  packagekit-tools pi-bluetooth policykit-1 python3-dev python3.9-dev qt5-gtk-platformtheme qt5-gtk-platformtheme:armhf raspberrypi-sys-mods systemd systemd-sysv systemd-timesyncd zlib1g:armhf zlib1g-dev
The following NEW packages will be installed:
  initscripts insserv startpar sysv-rc
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  init systemd-sysv (due to init) libc-bin libcrypt1:armhf libc6:armhf (due to libcrypt1:armhf) libgcc-s1:armhf
0 upgraded, 4 newly installed, 217 to remove and 3 not upgraded.
5 not fully installed or removed.
Need to get 183 kB of archives.
After this operation, 498 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'

it kinda scares meā€¦

Any recommendation how I should continue?

@stefan.hoehn This is not good. I would recommend to roll back the install. Check this file openhabian/functions/java-jre.bash at 0a677aa50dd1cb8997e93468ccf46cea38e98f9d Ā· openhab/openhabian Ā· GitHub to see what was done.

Could you pls. check if your installation is bookworm, /etc/debian_version should contain 12.9.
Is it 64 bit?

You could try temurin instead of openjdk.

I have not tried Java 21 installation on openhabian yet. If it does not work out, maybe open an issue on openhabian.

cat /etc/debian_version contains only

trixie/sid

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux trixie/sid"
NAME="Debian GNU/Linux"
VERSION_CODENAME=trixie
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

It seems I am already beyond bookworm and on trixie. At least I am not aware that I ever initiated that.

What do you mean by that?

@ndye Do you have an idea what could be the issue?

Not sure but it looks like you upgraded to ā€žsidā€œ
See here:
https://wiki.debian.org/DebianUnstable
This might come from choosing openjdk-21
ā€žecho deb [signed-by=/usr/share/keyrings/${keyName}.gpg] http://deb.debian.org/debian/ unstable main > /etc/apt/sources.list.d/java.listā€œ

Given all the armhf packages, are you sure you are on 64bit?

getconf LONG_BIT