Skip to content

[BUG] native java module reading error #132

@jkuhn1

Description

@jkuhn1

Describe the bug
When upgrading brotli4j from 1.12.0 to 1.13.0 (and onwards) in a Java modular application the following error was reported:

Error reading module: /home/jkuhn/.m2/repository/com/aayushatharva/brotli4j/native-linux-x86_64/1.15.0/native-linux-x86_64-1.15.0.jar'
java.lang.module.InvalidModuleDescriptorException: Package com.aayushatharva.brotli4j.linux.ppc64le not found in module'.

I've compared META-INF/versions/9/module-info.class files:

for native-linux-x86_64-1.12.0.jar:

module com.aayushatharva.brotli4j.linux.x86_64 {
  requires com.aayushatharva.brotli4j.service;
  requires java.base;
  
  exports com.aayushatharva.brotli4j.linux.x86_64 to com.aayushatharva.brotli4j;
  
  provides com.aayushatharva.brotli4j.service.BrotliNativeProvider with com.aayushatharva.brotli4j.linux.x86_64.NativeLoader;
}

from native-linux-x86_64-1.13.0.jar:

module com.aayushatharva.brotli4j.linux.ppc64le {
  requires com.aayushatharva.brotli4j.service;
  requires java.base;
  
  exports com.aayushatharva.brotli4j.linux.ppc64le to com.aayushatharva.brotli4j;
  
  provides com.aayushatharva.brotli4j.service.BrotliNativeProvider with com.aayushatharva.brotli4j.linux.ppc64le.NativeLoader;
}

So it seems from 1.13.0, x86_64 jar contains module descriptor for ppc64le and since the exported ppc64le package does not exist in the Jar the module is corrupted and can't be loaded. I haven't checked for other architectures but maybe they are also impacted.

To Reproduce
Create a Java modular application on linux x86_64 platform which uses brotli modules.

Expected behavior
native-linux-x86_64-1.15.0.jar must contain module com.aayushatharva.brotli4j.linux.x86_64.
ModuleFinder can load module com.aayushatharva.brotli4j.linux.x86_64 from native-linux-x86_64-1.15.0.jar

Logs
If applicable, add logs to help explain your problem.

Platform (please complete the following information):

  • Device: Linux
  • OS: Debian GNU/Linux 11 (bullseye) Linux 5.10.0-27-amd64
  • Java Version:
    openjdk version "21.0.1" 2023-10-17
    OpenJDK Runtime Environment (build 21.0.1+12-29)
    OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions