moditect / moditect

Tooling for the Java Module System
Apache License 2.0
552 stars 71 forks source link

AdoptOpenJDK 11.0.5 hash issue #103

Open lanthale opened 5 years ago

lanthale commented 5 years ago

I am using the following entry in pom.xml to get a runtime image but getting the following error:

Error: Hash of java.xml (349c0d313e0f9c7c7e6dc2ba6e9957844df4d1999f3955832eef498ad882a213) differs to expected hash (63d862347194373a50a9fca7e9c4be6c92f1dfa1e1f89de0f23426213a1fb8ed) recorded in java.base

                        <modulePath>
                            <path>${project.build.directory}/modules</path> <!--our modules-->
                        </modulePath>
                        <modules> <!--everything we need-->
                            <module>${moduleName}</module>
                            <module>java.base</module>
                            <module>javafx.base</module>
                            <module>javafx.fxml</module>
                            <module>javafx.swing</module>
                            <module>javafx.controls</module>
                            <module>javafx.graphics</module>
                            <module>javafx.web</module>
                        </modules>
                        <excludedResources>
                            <pattern>glob:/xxx.yyy/**</pattern>
                        </excludedResources>                            
                        <launcher>
                            <name>Schischulmanager</name> <!--the name of the application executable-->
                            <module>${moduleName}/${mainClass}</module>
                        </launcher>
                        <stripDebug>true</stripDebug>
                        <compression>2</compression>
                        <no-header-files>true</no-header-files>
                        <no-man-pages>true</no-man-pages>
                        <jdepsExtraArgs>
                            <args>--strip-native-commands</args>
                        </jdepsExtraArgs>
                        <outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
                    </configuration>
gunnarmorling commented 5 years ago

Could you share the complete stacktrace? Thanks!

sormuras commented 4 years ago

As @gunnarmorling asked indirectly for JMS-related traffic ... ;-) ... here we go:

Using java.runtime.version: 11.0.6+10-post-Ubuntu-2ubuntu2 produced

Error: Hash of java.xml (eca2f02d2602fccf403c97c1f37fbe3a4479b93c2dae67e47dba76f84f110526) differs to expected hash (c01eaedc447818c55a0e1887a0e68eaafbabffc7856b004a0d312be21aa80ab0) recorded in java.base

by calling jlink.

eitzenbe commented 4 years ago

@gunnarmorling add. env data and stacktrace

java -version openjdk version "14-ea" 2020-03-17 OpenJDK Runtime Environment (build 14-ea+18-Ubuntu-1) OpenJDK 64-Bit Server VM (build 14-ea+18-Ubuntu-1, mixed mode, sharing)

Error: Hash of java.xml (4d35ef9b03d581a8d8412519d3299eb444be327d792bb76736be3511ecf51c35) differs to expected hash (efc6c9330330296aece40bbfd7a341c6207b0d8b629494b0eb055a1a782836c8) recorded in java.base

Ubuntu 19.10

Stacktrace: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166) at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:504) at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:394) at org.openjfx.JavaFXJLinkMojo.execute (JavaFXJLinkMojo.java:187) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166) at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:504) at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:394) at org.openjfx.JavaFXJLinkMojo.execute(JavaFXJLinkMojo.java:187) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:192) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

gunnarmorling commented 4 years ago

Hum, can you run in verbose/debug mode to see the full jlink invocation and then execute this manually? Would be interesting to see the full exception as raised by jlink. I suppose something related to multiple JDKs being involved, but unclear about the details still.

eitzenbe commented 4 years ago

Sorry no additional info:

/usr/lib/jvm/java-11-openjdk-amd64/bin/jlink -v --add-modules Goldfinder --module-path /home/thomas/IdeaProjects/Goldfinder/target/Goldfinder-0.9.1.jar:/usr/lib/jvm/java-11-openjdk-amd64/jmods:/home/thomas/IdeaProjects/Goldfinder/target/dependency:/home/thomas/IdeaProjects/Goldfinder/target/modules --output /home/thomas/IdeaProjects/Goldfinder/target/jlink-image --launcher Goldfinder=Goldfinder/org.eitzen.goldfinder.GoldfinderUI Error: Hash of java.xml (b69625426dbd38182c4f2301e409c6e1f4ca7c92da9f320ec0831460df0506f5) differs to expected hash (091529a3c388cc1549df6d904d43f0ee56da7e52792c8e7a809280e0a9a80e8b) recorded in java.base

and with jdk14 /usr/lib/jvm/java-14-openjdk-amd64/bin/jlink -v --add-modules Goldfinder --module-path /home/thomas/IdeaProjects/Goldfinder/target/Goldfinder-0.9.1.jar:/usr/lib/jvm/java-14-openjdk-amd64/jmods:/home/thomas/IdeaProjects/Goldfinder/target/dependency:/home/thomas/IdeaProjects/Goldfinder/target/modules --output /home/thomas/IdeaProjects/Goldfinder/target/jlink-image --launcher Goldfinder=Goldfinder/org.eitzen.goldfinder.GoldfinderUI Error: Hash of java.xml (4d35ef9b03d581a8d8412519d3299eb444be327d792bb76736be3511ecf51c35) differs to expected hash (efc6c9330330296aece40bbfd7a341c6207b0d8b629494b0eb055a1a782836c8) recorded in java.base

eitzenbe commented 4 years ago

sorry me, stupid mistake. My problem came from using the bundled openjdk that comes with ubuntu. After installing the adoptopenjdk deb all works fine! So I am not able to reprodce this issue anymore...

richard-melvin commented 4 years ago

Can confirm; with the bundled openjdk 14.0.1 with ubuntu 20.04,

jlink build fails with:

[INFO] --- moditect-maven-plugin:1.0.0.RC1:create-runtime-image (create-runtime-image) @ sect-jlink ---
[DEBUG] Configuring mojo org.moditect:moditect-maven-plugin:1.0.0.RC1:create-runtime-image from plugin realm ClassRealm[plugin>org.moditect:moditect-maven-plugin:1.0.0.RC1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487]
[DEBUG] Configuring mojo 'org.moditect:moditect-maven-plugin:1.0.0.RC1:create-runtime-image' with basic configurator -->
[DEBUG]   (f) compression = 2
[DEBUG]   (f) ignoreSigningInformation = false
[DEBUG]   (s) name = SectTooling
[DEBUG]   (s) module = esa.sect.app
[DEBUG]   (f) launcher = org.moditect.mavenplugin.image.model.Launcher@4e0802e0
[DEBUG]   (f) mavenSession = org.apache.maven.execution.MavenSession@79fd6f95
[DEBUG]   (f) modulePath = [/vagrant_data/sect/sect-jlink/target/modules, /vagrant_data/sect/sect-jlink/target/sect-jlink-0.0.0-SNAPSHOT.jar]
[DEBUG]   (f) modules = [esa.sect.jlink]
[DEBUG]   (f) noHeaderFiles = true
[DEBUG]   (f) noManPages = false
[DEBUG]   (f) outputDirectory = /vagrant_data/sect/sect-jlink/target/jlink-image
[DEBUG]   (f) stripDebug = false
[DEBUG] -- end configuration --
[DEBUG] Running jlink: /usr/lib/jvm/java-14-openjdk-amd64/bin/jlink --add-modules esa.sect.jlink --module-path /vagrant_data/sect/sect-jlink/target/sect-jlink-0.0.0-SNAPSHOT.jar:/vagrant_data/sect/sect-jlink/target/modules:/usr/lib/jvm/java-14-openjdk-amd64/jmods --output /vagrant_data/sect/sect-jlink/target/jlink-image --launcher SectTooling=esa.sect.app --compress 2 --no-header-files
[DEBUG] Error: Hash of java.xml (5c0470b7e1f23ec63991ae852f2e6985035182851f78a7899873bd00c2035dd7) differs to expected hash (71dcb63fc998b21006f7905f2dcd12792237cc0bcaf257b849d159a144b1fe75) recorded in java.base
[ERROR] Error: Hash of java.xml (5c0470b7e1f23ec63991ae852f2e6985035182851f78a7899873bd00c2035dd7) differs to expected hash (71dcb63fc998b21006f7905f2dcd12792237cc0bcaf257b849d159a144b1fe75) recorded in java.base
:/usr/lib/jvm/java-14-openjdk-amd64$ jmod describe jmods/java.base.jmod 
java.base@14.0.1
..
platform linux-amd64
...
hashes java.xml SHA-256 71dcb63fc998b21006f7905f2dcd12792237cc0bcaf257b849d159a144b1fe75

` It seems the bundled jdk is completely broken...