Wouter Born created ARIES-2109:
----------------------------------

             Summary: ZipException when using org.apache.aries.javax.jax.rs-api 
bundle
                 Key: ARIES-2109
                 URL: https://issues.apache.org/jira/browse/ARIES-2109
             Project: Aries
          Issue Type: Bug
         Environment: Eclipse Temurin 17.0.8+9

Aries Whiteboard 2.0.0

CXF 3.4.5

Karaf 4.4.3

 
            Reporter: Wouter Born


Newer JVMs (11.0.20+9, 17.0.8+9) have "Improved ZIP64 Extra Field Validation" 
(JDK-8302483) which causes the following exceptions to be logged when using the 
{{org.apache.aries.spec:org.apache.aries.javax.jax.rs-api:1.0.4}} bundle in 
with the Aries JAR-RS Whiteboard, Apache CXF in Apache Karaf when running 
openHAB:

 

 
{code:java}
!ENTRY org.apache.aries.javax.jax.rs-api 4 0 2023-07-26 21:16:54.718
!MESSAGE FrameworkEvent ERROR
!STACK 0
java.util.zip.ZipException: Exception in opening zip file: 
/home/wouter/software/openhab/instance/userdata/cache/org.eclipse.osgi/62/0/.cp/lib/geronimo-osgi-locator.jar
    at 
org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:356)
    at 
org.eclipse.osgi.storage.bundlefile.ZipBundleFile.doOpen(ZipBundleFile.java:51)
    at 
org.eclipse.osgi.storage.bundlefile.CloseableBundleFile.internalOpen(CloseableBundleFile.java:140)
    at 
org.eclipse.osgi.storage.bundlefile.CloseableBundleFile.lockOpen(CloseableBundleFile.java:78)
    at 
org.eclipse.osgi.storage.bundlefile.CloseableBundleFile.getEntry(CloseableBundleFile.java:274)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathEntry.loadManifest(ClasspathEntry.java:230)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathEntry.<init>(ClasspathEntry.java:77)
    at 
org.eclipse.osgi.internal.loader.ModuleClassLoader.createClassPathEntry(ModuleClassLoader.java:267)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.createClassPathEntry(ClasspathManager.java:343)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.getClasspath(ClasspathManager.java:295)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.addStandardClassPathEntry(ClasspathManager.java:213)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.addClassPathEntry(ClasspathManager.java:205)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassPathEntry(ClasspathManager.java:188)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.buildClasspath(ClasspathManager.java:166)
    at 
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.<init>(ClasspathManager.java:94)
    at 
org.eclipse.osgi.internal.loader.EquinoxClassLoader.<init>(EquinoxClassLoader.java:54)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.createClassLoaderPrivledged(BundleLoader.java:345)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.getModuleClassLoader(BundleLoader.java:262)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle$1.run(EquinoxBundle.java:653)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle$1.run(EquinoxBundle.java:1)
    at 
java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle.getModuleClassLoader(EquinoxBundle.java:646)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle.getResource(EquinoxBundle.java:588)
    at 
org.apache.servicemix.specs.activation.Activator.register(Activator.java:58)
    at org.apache.servicemix.specs.locator.Activator.start(Activator.java:70)
    at org.apache.servicemix.specs.activation.Activator.start(Activator.java:46)
    at 
org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:818)
    at 
org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
    at 
java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at 
org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:810)
    at 
org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:767)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1032)
    at 
org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:371)
    at org.eclipse.osgi.container.Module.doStart(Module.java:605)
    at org.eclipse.osgi.container.Module.start(Module.java:468)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847)
    at 
org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1783)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667)
    at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at 
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at 
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
Caused by: java.util.zip.ZipException: Invalid CEN header (invalid zip64 extra 
data field size)
    at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1728)
    at 
java.base/java.util.zip.ZipFile$Source.checkExtraFields(ZipFile.java:1261)
    at 
java.base/java.util.zip.ZipFile$Source.checkAndAddEntry(ZipFile.java:1212)
    at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1667)
    at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1445)
    at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1407)
    at 
java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:716)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:250)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:179)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:193)
    at 
org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:342)
    ... 43 more {code}
To workaround these exception we had to disable this new JVM feature by setting 
the  property {{jdk.util.zip.disableZip64ExtraFieldValidation=true}}

 

The issue seems to be that the embedded {{geronimo-osgi-locator.jar}} library 
in the bundle has invalid headers.

 

On my Ubuntu system I could check that this embedded JAR has issues with:
{code:java}
$ zip -T geronimo-osgi-locator.jar 
META-INF/MANIFEST.MF   bad extra-field entry:
      EF block length (61373 bytes) exceeds remaining EF data (4 bytes)
test of geronimo-osgi-locator.jar FAILED
zip error: Zip file invalid, could not spawn unzip, or wrong unzip (original 
files unmodified) {code}
Another workaround I tried is replacing this bundle with 
{{jakarta.ws.rs:jakarta.ws.rs-api:2.1.6}}

However that bundle does not provide the {{osgi.contract=JavaJAXRS}} capability 
in its manifest which causes OSGi bundle resolution issues.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to