Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59772

GlobalTool JDK installation (via extract installer) fails for JDK12 onwards

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      When using the Global Tool Configuration to install a JDK, there are several types of installers.

      If the "Extract .zip/.tar.gz" is selected, it will fail from JDK 12 onwards.

      The error in the log is bellow:

      Started by user unknown or anonymous
      Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] nodeRunning on [Jenkins|https://<URL>/computer/(master)/] in /tmp/jenkins/<WORKSPACE>[Pipeline] {[Pipeline] stage[Pipeline] { (Declarative: Tool Install)[Pipeline] toolUnpacking [https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz] to /opt/jenkins/tools/hudson.model.JDK/openjdk12_fails on Jenkins[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // node[Pipeline] End of Pipelinejava.nio.file.NoSuchFileException: /opt/jenkins/tools/hudson.model.JDK/openjdk12_fails/./jdk-12.0.2.jdk/Contents/Home/lib/server/classes.jsa
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
      	at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
      	at java.nio.file.Files.newOutputStream(Files.java:216)
      	at hudson.util.IOUtils.copy(IOUtils.java:42)
      	at hudson.FilePath.readFromTar(FilePath.java:2579)
      Caused: java.io.IOException: Failed to extract input stream
      	at hudson.FilePath.readFromTar(FilePath.java:2589)
      	at hudson.FilePath.access$500(FilePath.java:212)
      	at hudson.FilePath$UntarFrom.invoke(FilePath.java:812)
      	at hudson.FilePath$UntarFrom.invoke(FilePath.java:803)
      	at hudson.FilePath.act(FilePath.java:1076)
      	at hudson.FilePath.act(FilePath.java:1059)
      	at hudson.FilePath.untarFrom(FilePath.java:798)
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:930)
      Caused: java.io.IOException: Failed to unpack 
      [https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz]
       (183950127 bytes read of total 190273787)
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:932)
      Caused: java.io.IOException: Failed to install 
      [https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz]
       to /opt/jenkins/tools/hudson.model.JDK/openjdk12_fails
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:846)
      	at hudson.tools.ZipExtractionInstaller.performInstallation(ZipExtractionInstaller.java:83)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
      	at hudson.model.JDK.forNode(JDK.java:147)
      	at hudson.model.JDK.forNode(JDK.java:60)
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Finished: FAILURE
      

      In order to reproduce it, the bellow code can be used:

      pipeline {
          agent { node { label 'master' } }
          tools {
              jdk "openjdk12"
          }
          stages {
              stage('Build') {
                  steps {
                      sh "echo Hello World"
                  }
              }
          }
      }
      

      And the Global tool configuration should be configured as per the attached image.

        Attachments

          Activity

          Hide
          knyvel Ricardo Gato added a comment -

          The issue is caused, due to the existence of the classes.jsa file, introduced after JDK11. The unzipping process will abort, as soon as it reaches this file.

          It does not matter the location/content of the classes.jsa file inside the zip - i tested several combinations; as soon as the file is renamed to something else, the unzipping will work.

          Show
          knyvel Ricardo Gato added a comment - The issue is caused, due to the existence of the classes.jsa file, introduced after JDK11. The unzipping process will abort, as soon as it reaches this file. It does not matter the location/content of the classes.jsa file inside the zip - i tested several combinations; as soon as the file is renamed to something else, the unzipping will work.
          Hide
          danielbeck Daniel Beck added a comment -

          Running

          docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:2.190.1 

          and this pipeline (different tool name, got that one wrong in tool config), produces

          Started by user admin
          Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/jenkins_home/workspace/pl
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Declarative: Tool Install)
          [Pipeline] tool
          Unpacking https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz to /var/jenkins_home/tools/hudson.model.JDK/jdk12 on Jenkins
          [Pipeline] envVarsForTool
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Build)
          [Pipeline] tool
          [Pipeline] envVarsForTool
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] sh
          + echo Hello World
          Hello World
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS 

          Indicating the problem here is likely environmental.

          Show
          danielbeck Daniel Beck added a comment - Running docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:2.190.1 and this pipeline (different tool name, got that one wrong in tool config), produces Started by user admin Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/jenkins_home/workspace/pl [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Tool Install) [Pipeline] tool Unpacking https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz to /var/jenkins_home/tools/hudson.model.JDK/jdk12 on Jenkins [Pipeline] envVarsForTool [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Build) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] withEnv [Pipeline] { [Pipeline] sh + echo Hello World Hello World [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS Indicating the problem here is likely environmental.
          Hide
          danielbeck Daniel Beck added a comment -

          Also retried it on the host Mac OS system, and got

          Started by user admin
          Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /Users/danielbeck/Jenkins/Homes/jdk-home/workspace/pl
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Declarative: Tool Install)
          [Pipeline] tool
          Unpacking https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz to /Users/danielbeck/Jenkins/Homes/jdk-home/tools/hudson.model.JDK/openjdk12 on Jenkins
          [Pipeline] envVarsForTool
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Build)
          [Pipeline] tool
          [Pipeline] envVarsForTool
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] sh
          + echo Hello World
          Hello World
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS 
          Show
          danielbeck Daniel Beck added a comment - Also retried it on the host Mac OS system, and got Started by user admin Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /Users/danielbeck/Jenkins/Homes/jdk-home/workspace/pl [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Tool Install) [Pipeline] tool Unpacking https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_osx-x64_bin.tar.gz to /Users/danielbeck/Jenkins/Homes/jdk-home/tools/hudson.model.JDK/openjdk12 on Jenkins [Pipeline] envVarsForTool [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Build) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] withEnv [Pipeline] { [Pipeline] sh + echo Hello World Hello World [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS

            People

            • Assignee:
              Unassigned
              Reporter:
              knyvel Ricardo Gato
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: