Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] native java module reading error #132

Closed
jkuhn1 opened this issue Jan 19, 2024 · 2 comments · Fixed by #133
Closed

[BUG] native java module reading error #132

jkuhn1 opened this issue Jan 19, 2024 · 2 comments · Fixed by #133

Comments

@jkuhn1
Copy link

jkuhn1 commented Jan 19, 2024

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.

@hyperxpro
Copy link
Owner

Fixed in #130

Release will be cut soon

@jkuhn1
Copy link
Author

jkuhn1 commented Jan 23, 2024

Fixed in #130

Release will be cut soon

Actually #130 won't solve that particular issue for linux_x86_64 platform. If you look at https://github.com/hyperxpro/Brotli4j/blob/main/natives/linux-x86_64/pom.xml you'll see the javaModuleName property is not correctly set:

<properties>
    <javaModuleName>com.aayushatharva.brotli4j.linux.s390x</javaModuleName>
    <javaModuleName>com.aayushatharva.brotli4j.linux.ppc64le</javaModuleName>
</properties>

instead of:

<properties>
    <javaModuleName>com.aayushatharva.brotli4j.linux.x86_64</javaModuleName>
</properties>

This bug was introduced in #102

@hyperxpro hyperxpro linked a pull request Jan 24, 2024 that will close this issue
@hyperxpro hyperxpro reopened this Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants