Error on startup with Invalid CEN header exception

Description

Installed OpenNMS Horizon 32.0.1 on a clean system with the latest OpenJDK. The application won’t start and shows the following error message in the OpenNMS system unit log file

journalctl -f -u opennms
Caused by: java.util.zip.ZipException: Invalid CEN header (invalid zip64 extra data field size)

The latest OpenJDK has added ZIP64 extra field validation which leads to this problem. Documented in https://www.oracle.com/java/technologies/javase/11-0-20-relnotes.html .

Workaround

echo "ADDITIONAL_MANAGER_OPTIONS=-Djdk.util.zip.disableZip64ExtraFieldValidation=true" | sudo -u opennms tee -a /etc/opennms/opennms.conf

Make sure OpenNMS is stopped, cleanup the Karaf cache and restart OpenNMS

systemctl stop opennms # verify with ps aux | grep java # Cleanup Karaf cache cd ${OPENNMS_HOME}/bin/fix-karaf-setup.sh # Restart systemctl start opennms

The exception should be gone and the OSGi components should start up.

Environment

Java: * OpenJDK JDK 17.0.8 * OpenJDK JDK 11.0.20 OS: * Rocky Linux 9 * Debian 12 * Ubuntu 22.04 LTS

Acceptance / Success Criteria

OpenNMS Horizon/Meridian should be able to start with the Zip64 extra field validation enabled

Activity

Show:

Daniel Luke August 1, 2023 at 3:57 PM

For others searching - adding EXTRA_JAVA_OPTS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true" to /etc/default/minion is necessary for the minion (ubuntu 22.04)

Anonymous July 31, 2023 at 10:06 PM

Seen the same with Ubuntu 22.04.2 LTS with

openjdk version "17.0.8" 2023-07-18 OpenJDK Runtime Environment (build 17.0.8+7-Ubuntu-122.04) OpenJDK 64-Bit Server VM (build 17.0.8+7-Ubuntu-122.04, mixed mode, sharing)

and Debian 12 with Java

openjdk version "17.0.8" 2023-07-18 OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1) OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode, sharing)

Jeff Gehlbach July 31, 2023 at 9:30 PM

Making this a little more searchable; if you see the following in your web.log, you’re probably hitting this issue:

Caused by: java.util.zip.ZipException: Invalid CEN header (invalid zip64 extra data field size) at java.util.zip.ZipFile$Source.zerror(ZipFile.java:1728) ~[?:?] at java.util.zip.ZipFile$Source.checkExtraFields(ZipFile.java:1261) ~[?:?] at java.util.zip.ZipFile$Source.checkAndAddEntry(ZipFile.java:1212) ~[?:?] at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1667) ~[?:?] at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1445) ~[?:?] at java.util.zip.ZipFile$Source.get(ZipFile.java:1407) ~[?:?] at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:716) ~[?:?] at java.util.zip.ZipFile.<init>(ZipFile.java:250) ~[?:?] at java.util.zip.ZipFile.<init>(ZipFile.java:179) ~[?:?] at java.util.zip.ZipFile.<init>(ZipFile.java:193) ~[?:?] at org.apache.felix.framework.util.SecureAction.openZipFile(SecureAction.java:651) ~[?:?] at org.apache.felix.framework.util.WeakZipFileFactory$WeakZipFile.<init>(WeakZipFileFactory.java:169) ~[?:?] at org.apache.felix.framework.util.WeakZipFileFactory$WeakZipFile.<init>(WeakZipFileFactory.java:151) ~[?:?] at org.apache.felix.framework.util.WeakZipFileFactory.create(WeakZipFileFactory.java:78) ~[?:?] at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:83) ~[?:?] at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:793) ~[?:?] at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:480) ~[?:?] at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:148) ~[?:?] at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:462) ~[?:?] at org.apache.felix.framework.Felix.installBundle(Felix.java:3227) ~[?:?] at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:147) ~[?:?] at org.apache.karaf.main.Main.installAndStartBundles(Main.java:606) ~[org.apache.karaf.main-4.3.6.jar:4.3.6] ... 70 more

Jeff Gehlbach July 31, 2023 at 9:26 PM

java.util.zip.ZipFile has been updated to provide additional validation of ZIP64 extra fields when opening a ZIP file. This validation may be disabled by setting the system property jdk.util.zip.disableZip64ExtraFieldValidation to true.

Jeff Gehlbach July 31, 2023 at 9:00 PM

I’ve seen this with both java-11-openjdk-11.0.20.0.8 and java-17-openjdk-17.0.8.0.7-2.el9.x86_64, which are currently the latest in the Rocky Linux repos.

Fixed

Details

Assignee

Reporter

Sprint

Priority

PagerDuty

Created July 31, 2023 at 8:58 PM
Updated December 6, 2024 at 5:25 PM
Resolved August 1, 2023 at 1:35 PM

Flag notifications