Bug 284565 - net-mgmt/zabbix7-java: java.lang.UnsupportedClassVersionError
Summary: net-mgmt/zabbix7-java: java.lang.UnsupportedClassVersionError
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Juraj Lutter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-04 14:36 UTC by Einar Bjarni Halldórsson
Modified: 2025-02-11 16:36 UTC (History)
2 users (show)

See Also:
vvd: maintainer-feedback? (otis)


Attachments
Set JAVA_VERSION to 11+ for zabbix7-java (1.06 KB, patch)
2025-02-05 09:28 UTC, Einar Bjarni Halldórsson
einar: maintainer-approval? (otis)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Einar Bjarni Halldórsson 2025-02-04 14:36:11 UTC
After upgrading zabbix7-java from 7.0.8 to 7.0.9, the zabbix_java service stopped working and failed with this error:

$ sudo service zabbix_java start
Exception in thread "main" java.lang.UnsupportedClassVersionError: ch/qos/logback/classic/spi/LogbackServiceProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at org.slf4j.LoggerFactory.safelyInstantiate(LoggerFactory.java:152)
	at org.slf4j.LoggerFactory.findServiceProviders(LoggerFactory.java:133)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:194)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:186)
	at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:496)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:482)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:431)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:457)
	at com.zabbix.gateway.JavaGateway.<clinit>(JavaGateway.java:29)
Zabbix Java Gateway did not start


If I install openjdk21 it works again. I assume JAVA_VERSION needs to be set.

I'm building packages with poudriere, the build options I've changed for zabbix7-server are:

- PGSQL
- LDAP
- IPMI
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-02-04 16:01:20 UTC
(In reply to Einar Bjarni Halldórsson from comment #0)
https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-4.html#jvms-4.1-200-B.2

In short: upgrade your java/openjdk8 to java/openjdk11 (or 17, or 21).
Comment 2 Einar Bjarni Halldórsson 2025-02-04 20:18:04 UTC
(In reply to Vladimir Druzenko from comment #1)

Yes, I'm aware, like I said in my comment, I fixed it by installing openjdk21.

I opened the issue because zabbix7-java pulls in openjdk8, but it should be pulling in openjdk 11+
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2025-02-04 21:16:29 UTC
(In reply to Einar Bjarni Halldórsson from comment #2)
Missed this…

You can create and attach patch for net-mgmt/zabbix7-java/Makefile:
 .if ${ZABBIX_BUILD} == "java"
 USES+=         java
+JAVA_VERSION=  11+
 .endif
Comment 4 Einar Bjarni Halldórsson 2025-02-05 09:28:45 UTC
Created attachment 257250 [details]
Set JAVA_VERSION to 11+ for zabbix7-java
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-02-11 16:35:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a5baceeb886d83daf03e225a78b184619c393772

commit a5baceeb886d83daf03e225a78b184619c393772
Author:     Juraj Lutter <otis@FreeBSD.org>
AuthorDate: 2025-02-11 16:22:20 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2025-02-11 16:22:20 +0000

    net-mgmt/zabbix6-java: Fix JAVA version

    Recent zabbix 6 java components requires OpenJDK 11 or newer

    PR:             284565
    Reported by:    Einar Bjarni Halldórsson <einar@isnic.is>

 net-mgmt/zabbix6-java/Makefile   | 2 +-
 net-mgmt/zabbix6-server/Makefile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-02-11 16:35:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2bd2c3470c7f4b03e8ef0431537d0c4c2581b604

commit 2bd2c3470c7f4b03e8ef0431537d0c4c2581b604
Author:     Einar Bjarni Halldórsson <einar@isnic.is>
AuthorDate: 2025-02-11 16:16:32 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2025-02-11 16:18:47 +0000

    net-mgmt/zabbix7-java: Fix JAVA version

    Recent zabbix 7 java components requires OpenJDK 11 or newer

    PR:             284565
    Reported by:    Einar Bjarni Halldórsson <einar@isnic.is>

 net-mgmt/zabbix7-java/Makefile   | 2 +-
 net-mgmt/zabbix7-server/Makefile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-02-11 16:35:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4fa9e2774b4285407beae869d2e2d9c00ee7f049

commit 4fa9e2774b4285407beae869d2e2d9c00ee7f049
Author:     Juraj Lutter <otis@FreeBSD.org>
AuthorDate: 2025-02-11 16:21:37 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2025-02-11 16:21:37 +0000

    net-mgmt/zabbix72-java: Fix JAVA version

    Recent zabbix 7.2 java components requires OpenJDK 11 or newer

    PR:             284565
    Reported by:    Einar Bjarni Halldórsson <einar@isnic.is>

 net-mgmt/zabbix72-java/Makefile   | 2 +-
 net-mgmt/zabbix72-server/Makefile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 8 Juraj Lutter freebsd_committer freebsd_triage 2025-02-11 16:36:29 UTC
Committed, thanks!