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

jlink fails with java.io.IOException: Invalid JMOD file #3090

Closed
metametadata opened this issue Dec 26, 2020 · 16 comments
Closed

jlink fails with java.io.IOException: Invalid JMOD file #3090

metametadata opened this issue Dec 26, 2020 · 16 comments
Assignees
Labels

Comments

@metametadata
Copy link

jlink doesn't work in 20.3.0. But seems to work in the latest dev build.

Steps to reproduce the issue
Invoke jlink. Observe the output.

Expected

Error: --output must be specified
Usage: jlink --module-path --add-modules [,...]
Use --help for a list of possible options

Actual

Error: java.io.IOException: Invalid JMOD file: /Users/yuri/.sdkman/candidates/java/20.3.0.r11-grl/jmods/jdk.jartool.jmod

Describe GraalVM and your environment:

  • GraalVM version: 20.3.0

    openjdk version "11.0.9" 2020-10-20
    OpenJDK Runtime Environment GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06)
    OpenJDK 64-Bit Server VM GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06, mixed mode, sharing)

  • JDK major version: 11.
  • OS: macOS Catalina 10.15.6.
  • Architecture: AMD64.

More details

  • On macOS JDKs were installed using sdkman.
  • Also reproducible in Windows 2012 (installing via choco install -y graalvm --version 20.3.0).
  • Doesn't seem to be reproducible in v20.0.0 and v20.2.0.
  • Doesn't seem to be reproducible in graalvm-ce-java11-21.1.0-dev.
@oubidar-Abderrahim
Copy link
Member

If it cannot be reproduced in the latest dev, that means that the bug was already fixed.
Since there's no action for us to do here, I am closing the issue.

@tjwatson
Copy link

This is reproducible on 21.0.0 also.

@tjwatson
Copy link

I did test GraalVM CE 21.1.0-dev-20210120_0306 and it does work with that. Not sure if the final release process is somehow corrupting this module. Hopefully the 21.1.0 release will prove otherwise and it works in the release of 21.1.0.

@oubidar-Abderrahim
Copy link
Member

I tested on my macOS. it seems that the only part that is not working is invoking jlink without any parameters (which is supposed to throw Error: --output must be specified message). but running commands like jlink --help jlink --version jlink --list-plugins seems to be running without issues.

Please verify that this is the case for you too.

@tjwatson
Copy link

I can verify that graalvm-ce-java11-21.0.0 correctly prints messages when using --help, --version, --list-plugins. But fails with Invalid JMOD file: .../graalvm-ce-java11-21.0.0/Contents/Home/jmods/jdk.jartool.jmod when invoked with no parameters.

Other interesting thing:

graalvm-ce-java11-21.0.0/Contents/Home/bin/jlink --version
11.0.10

vs.

graalvm-ce-java11-21.1.0-dev/Contents/Home/bin/jlink --version
11.0.9

I was not expecting the version to go down 11.0.10 -> 11.0.9

Perhaps the release is pulling in a mismatched version?

@metametadata
Copy link
Author

Please verify that this is the case for you too.

It's the case for me with 20.3.0 and 21.0.0 on macOS. But just in case, my main issue is that building of a new JVM fails with the error. Example:

~ ᐅ jlink --add-modules java.naming --output foo
Error: java.io.IOException: Invalid JMOD file: /Users/yuri/.sdkman/candidates/java/21.0.0.r11-grl/jmods/jdk.jartool.jmod

@oubidar-Abderrahim
Copy link
Member

Issue tracked internally on GR-28952

@xodbc
Copy link

xodbc commented Feb 9, 2021

on windows:
21.0.0 ×
20.3.1 ×
20.3.0 ×
jlink --module-path jmods --add-modules java.base --output jre Error: java.io.IOException: Invalid JMOD file: xxx\java.base.jmod
20.2.0 √

and v20.2.0 jre:
ClassNotFoundException: org.graalvm.compiler.hotspot.management.JMXToLibGraalCalls

@gilles-duboscq
Copy link
Member

Yes, the same bug affects both windows and darwin. Should be fixed for future releases.

@tjwatson
Copy link

For the latest release 21.0.0.2 on the Mac it seems jlink now launches and tries to do something but now I get errors like this when trying to create the jlink image:

[ERROR] Error: Hash of java.management (ebf0ea14412a93994827c313e130b5dce32cfa61e2ce7eafe629842c1e74f1b8) differs to expected hash (6c502b1f9b010ac21e35dca42053ca6ac5b08d2f3468f72545c981e72a843880) recorded in java.base

To reproduce clone https://github.com/apache/felix-atomos.git and run mvn clean install -Pequinox from the felix-atomos directory.

There is a jlink example atomos.examples.jlink that will fail to create the jlink image (using moditect plugin)

java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

@blackjyn
Copy link

Affect me on Windows too.
When using regular JDK, I succeed but when using GraalVM it failed:
graalVM_JDKFX-failed

@gilles-duboscq
Copy link
Member

@blackjyn, the "Invalid JMOD file" issue is resolved and should already be fixed in 21.0.0.2. However I suspect you will still get the hash issue mentioned by @tjwatson above.

@blackjyn
Copy link

@blackjyn, the "Invalid JMOD file" issue is resolved and should already be fixed in 21.0.0.2. However I suspect you will still get the hash issue mentioned by @tjwatson above.

Will wait till the issues resolved instead. Thanks.

@zekronium
Copy link

For the latest release 21.0.0.2 on the Mac it seems jlink now launches and tries to do something but now I get errors like this when trying to create the jlink image:

[ERROR] Error: Hash of java.management (ebf0ea14412a93994827c313e130b5dce32cfa61e2ce7eafe629842c1e74f1b8) differs to expected hash (6c502b1f9b010ac21e35dca42053ca6ac5b08d2f3468f72545c981e72a843880) recorded in java.base

To reproduce clone https://github.com/apache/felix-atomos.git and run mvn clean install -Pequinox from the felix-atomos directory.

There is a jlink example atomos.examples.jlink that will fail to create the jlink image (using moditect plugin)

java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

To add to this, same thing happens with java.rmi JMOD on Windows

Error: Hash of java.rmi (8ad91002120b0559105cb44c00e97858cbd95ddf7874c2db54f9ed9f2c3ee519) differs to expected hash (df22c3c42f004d878ffd749a56deec66a4cd9e5e75edaa30c3d196a7392e7852) recorded in java.base

java -version output:

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

@gorankarlic
Copy link

gorankarlic commented Oct 31, 2021

Still present in GraalVM CE 21.3.0 (Windows x64):

> bin\jlink --output jre-11.0.13 --add-modules java.base,java.rmi
Error: Hash of java.rmi (f671e42903a0adce0642b577802ce36274988cf9a88dc3b2115be3d6cd7e5677) differs to expected hash (abb5652878595f7bbe89256539153df4c639d2446b5baa127cf71ef8d4d18d8b) recorded in java.base
> bin\java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05, mixed mode, sharing)

@metametadata
Copy link
Author

Cannot reproduce in 22.0.0.2 (build 17.0.2+8-jvmci-22.0-b05) on macOS and Windows.

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants