Skip to content

gdk-parent:4.10.17 selects malformed Netty 4.2.16.Final-oracle-00001 JARs, causing InvalidJarIndexError on JDK 17 #88

Description

@jasonlyle88

Component

GDK dependency packaging/publishing, specifically the Oracle-repackaged io.netty artifacts.

Description

Disclamer: this was generated with AI from a real issue found in a project

Upgrading from cloud.graal.gdk:gdk-parent:4.10.15 to 4.10.17 changes the managed Netty version:

gdk-parent 4.10.15 -> io.netty:*:4.2.15.Final
gdk-parent 4.10.17 -> io.netty:*:4.2.16.Final-oracle-00001

On JDK 17, loading Netty HTTP classes from 4.2.16.Final-oracle-00001 can fail with:

jdk.internal.util.jar.InvalidJarIndexError: Invalid index

At least netty-codec-http-4.2.16.Final-oracle-00001.jar contains a stale META-INF/INDEX.LIST. The index claims that the JAR contains:

io/netty/handler/codec

However, the Oracle-repackaged JAR no longer contains the corresponding ZIP directory entry:

io/netty/handler/codec/

When io.netty.handler.codec.http.HttpResponse is loaded, Java must resolve DecoderResultProvider and DecoderResult from netty-codec-base. The stale index directs the lookup back to netty-codec-http; JDK 17 validates the mapping, finds that it is inconsistent, and throws InvalidJarIndexError.

The upstream io.netty:*:4.2.16.Final artifacts preserve the directory entries and do not fail.

Expected behavior

Oracle-repackaged Netty artifacts should load successfully on supported JDKs and contain either:

  • A regenerated, valid META-INF/INDEX.LIST;
  • The directory entries referenced by the index; or
  • No JAR index.

Actual behavior

Class loading fails on JDK 17 before application or test code can start.

Suggested fix

Republish the affected 4.2.16.Final-oracle-00001 artifacts with a corrected or removed META-INF/INDEX.LIST, then update the GDK BOM/parent to select the corrected artifact revision.

Minimal reproducer

Use JDK 17 and a repository configuration that can resolve the -oracle-00001 artifacts.

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>repro</groupId>
  <artifactId>netty-invalid-jar-index-repro</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <maven.compiler.release>17</maven.compiler.release>
    <netty.version>4.2.16.Final-oracle-00001</netty.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-http</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-base</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.14.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
    </plugins>
  </build>
</project>

src/test/java/repro/NettyJarIndexTest.java:

package repro;

import org.junit.jupiter.api.Test;

final class NettyJarIndexTest {
    @Test
    void loadsNettyHttpResponse() throws ClassNotFoundException {
        Class.forName("io.netty.handler.codec.http.HttpResponse");
    }
}

Run:

java -version
mvn test

With JDK 17 and 4.2.16.Final-oracle-00001, the test fails with:

NettyJarIndexTest.loadsNettyHttpResponse » InvalidJarIndex Invalid index

Control test:

mvn -Dnetty.version=4.2.16.Final test

That passes. I verified both outcomes locally with JDK 17. I also observed that JDK 26 does not throw this error, so the report should specify JDK 17 explicitly.

Inspecting the malformed artifact

unzip -p \
  ~/.m2/repository/io/netty/netty-codec-http/4.2.16.Final-oracle-00001/netty-codec-http-4.2.16.Final-oracle-00001.jar \
  META-INF/INDEX.LIST |
  grep '^io/netty/handler/codec$'

This returns the indexed package. But:

jar tf \
  ~/.m2/repository/io/netty/netty-codec-http/4.2.16.Final-oracle-00001/netty-codec-http-4.2.16.Final-oracle-00001.jar |
  grep '^io/netty/handler/codec/$'

returns nothing. Running the same check against upstream 4.2.16.Final returns the directory entry.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions