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

Docker builder publisher reports ClassNotFound: org.apache.commons.compress.archivers.ArchiveEntry on 2.489

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • docker-java-api-plugin
    • None
    • Jenkins 2.489
      Docker plugin 1.7.0
      Docker Java API plugin 3.4.0-94.v65ced49b_a_7d5
    • 3.4.0-95.v80b_75fd32678

      When a docker container is built by the docker-plugin using the build and publish step, it fails on Jenkins 2.489 or newer with a class not found exception for commons compress. The sample Pipeline I used to show the problem is:

      pipeline {
          agent {
              label 'docker'
          }
          stages {
              stage('Build container') {
                  steps {
                      sh "echo 'FROM jenkins/jenkins:lts' > Dockerfile" 
                      step([$class: 'DockerBuilderPublisher', 
                              cloud: 'mark-pc2', 
                              dockerFileDirectory: '.', 
                              pushOnSuccess: false, 
                              tagsString: 'my-image'])
                  }
              }
          }
      }
      

      That assumes a Docker cloud named 'mark-pc2'. It fails with the stack trace:

      Caused: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveEntry
              at PluginClassLoader for docker-java-api//com.github.dockerjava.core.dockerfile.Dockerfile$ScannedResult.buildDockerFolderTar(Dockerfile.java:134)
              at PluginClassLoader for docker-java-api//com.github.dockerjava.core.dockerfile.Dockerfile$ScannedResult.buildDockerFolderTar(Dockerfile.java:124)
              at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$DockerBuildCallable.invoke(DockerBuilderPublisher.java:495)
              at PluginClassLoader for docker-plugin//com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$DockerBuildCallable.invoke(DockerBuilderPublisher.java:491)
              at Jenkins v2.489//hudson.FilePath$FileCallableWrapper.call(FilePath.java:3593)
              at hudson.remoting.UserRequest.perform(UserRequest.java:225)
              at hudson.remoting.UserRequest.perform(UserRequest.java:50)
              at hudson.remoting.Request$2.run(Request.java:391)
              at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:81)
              at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
              at java.base/java.lang.Thread.run(Thread.java:1583)
      

      Workaround

      Install the incremental build of the docker Java API plugin.,

            skygo Eric Barboni
            itfsw He Wei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: