Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345881

Interoperability issue when jlink and jmod module path uses different JDK

XMLWordPrintable

      The issue is related to a hash mismatch error with the use of OracleJDK11u jlink to create installer for any OpenJDK11u (or other JDK vendor based on OpenJDK11u) generated jmod or vice versa.

      Steps to reproduce :
      1. Use jlink from oracle JDK bundle
      2. Download a IBM/OpenJDK11u budle
      3. Pass the module path for jlink as the jmods directory bundled in IBM/OpenJDK11u bundle
      4. Add java.base, java.rmi modules

      Sample:
      {PATH_TO_ORACLE_JDK11u}/bin/jlink --module-path {PATH_TO_OPENJDK11u}/jmods --add-modules java.base,java.rmi --output ./jdk11customjre

      Example:
      'jlink --module-path ~/software/ibmjdk11.0.25/jmods --add-modules java.base, java.rmi --output ./jdk11semeru'
      Error: Hash of java.rmi (d7bd5c6b1a32c8d0520004a41b38d757aeb7084381b189e249ccac659883a425) differs to expected hash (57c8106820f3635c9c1ad3fafcc0c455f1fa4dff575d61d412e37a2013dcc50d) recorded in java.base


      Root Cause:

      The JDK-8243666 fix introduces a change in calculation of hash logic for jmod files in JDK15, the fix was backported to OpenJDK11u (11.0.16) and OracleJDK deferred the backport.
      Now when Oracle JDK jlink is used with OpenJDK generated jmods, jlink verfies the hash recorded in jmod against the hash calculated at runtime by jlink.
      Since the hash computation logic differs in OpenJDK (post the backport of JDK-8243666) and Oracle JDK, the verfication fails leading to hash mismatch exception.

            pkumaraswamy Prajwal Kumaraswamy
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: