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

LogConfigurationException due to conflicting commons-logging versions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: swarm-plugin
    • Labels:
      None
    • Environment:
      LTS 1.565.1
    • Similar Issues:

      Description

      We run a Maven type job using Jenkins version 1.565.1.
      When building on master, the job builds fine.
      When using a swarm client, the job fails with the following error shown in the console log:

      ...
      	at org.kohsuke.stapler.Stapler.<clinit>(Stapler.java:1062)
      	... 51 more
      Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
      	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
      	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
      	... 56 more
      Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
      	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
      	... 57 more
      channel stopped
      

        Attachments

          Activity

          rkok Rene Kok created issue -
          Hide
          rkok Rene Kok added a comment - - edited

          We found a workaround by patching swarm-client-1.16-jar-with-dependencies.jar:
          We removed the commons-logging dependency and replaced it with the classes from commons-logging-1.1.3

          mkdir /tmp/swarm-client /tmp/commons-logging
           
          cd /tmp/swarm-client
          curl --silent -o swarm-client-1.16-jar-with-dependencies.jar http://${OUR_REPOSITORY}/jcenter/org/jenkins-ci/plugins/swarm-client/1.16/swarm-client-1.16-jar-with-dependencies.jar
          unzip swarm-client-1.16-jar-with-dependencies.jar
           
          cd /tmp/commons-logging
          curl --silent -o commons-logging-1.1.3.jar  http://${OUR_REPOSITORY}/jcenter/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
          unzip commons-logging-1.1.3.jar
           
          mv /tmp/swarm-client/org/apache/commons/logging/ /tmp/swarm-client/org/apache/commons/logging.NOTUSED
          mv /tmp/commons-logging/org/apache/commons/logging/ /tmp/swarm-client/org/apache/commons
           
          cd /tmp/swarm-client
          rm swarm-client-1.16-jar-with-dependencies.jar
          zip -r swarm-client-1.16-MODIFIED-jar-with-dependencies.jar hudson jenkins META-INF org
          
          Show
          rkok Rene Kok added a comment - - edited We found a workaround by patching swarm-client-1.16-jar-with-dependencies.jar: We removed the commons-logging dependency and replaced it with the classes from commons-logging-1.1.3 mkdir /tmp/swarm-client /tmp/commons-logging cd /tmp/swarm-client curl --silent -o swarm-client-1.16-jar-with-dependencies.jar http: //${OUR_REPOSITORY}/jcenter/org/jenkins-ci/plugins/swarm-client/1.16/swarm-client-1.16-jar-with-dependencies.jar unzip swarm-client-1.16-jar-with-dependencies.jar cd /tmp/commons-logging curl --silent -o commons-logging-1.1.3.jar http: //${OUR_REPOSITORY}/jcenter/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar unzip commons-logging-1.1.3.jar mv /tmp/swarm-client/org/apache/commons/logging/ /tmp/swarm-client/org/apache/commons/logging.NOTUSED mv /tmp/commons-logging/org/apache/commons/logging/ /tmp/swarm-client/org/apache/commons cd /tmp/swarm-client rm swarm-client-1.16-jar-with-dependencies.jar zip -r swarm-client-1.16-MODIFIED-jar-with-dependencies.jar hudson jenkins META-INF org
          Hide
          mindjiver Peter Jönsson added a comment -

          Is this still an issue with latest version?

          Show
          mindjiver Peter Jönsson added a comment - Is this still an issue with latest version?
          Hide
          rkok Rene Kok added a comment -

          This is still an issue with Jenkins LTS version 1.565.3 and Swarm plugin 1.19

          Show
          rkok Rene Kok added a comment - This is still an issue with Jenkins LTS version 1.565.3 and Swarm plugin 1.19
          Hide
          thallgren Thomas Hallgren added a comment -

          I'm experiencing a similar problem with version 1.590. The plug-in I'm using depends on guice-4.0-beta5 and 'com.google.' packages are masked off (using <maskClasses> in the maven-hpi-plugin). Works fine on the master but on a slave it crashes because it uses guice-4.0-beta - no_aop (provided by jenkins-core).

          Could it be that the <maskClasses> directive isn't propagated correctly to the swarm client?

          Show
          thallgren Thomas Hallgren added a comment - I'm experiencing a similar problem with version 1.590. The plug-in I'm using depends on guice-4.0-beta5 and 'com.google.' packages are masked off (using <maskClasses> in the maven-hpi-plugin). Works fine on the master but on a slave it crashes because it uses guice-4.0-beta - no_aop (provided by jenkins-core). Could it be that the <maskClasses> directive isn't propagated correctly to the swarm client?
          Hide
          gtheraud Guillaume Théraud added a comment -

          Same problem here with jenkins-swarm 1.22 & Jenkins 1.599.
          Did not manage to apply the workaround with those versions.

          Show
          gtheraud Guillaume Théraud added a comment - Same problem here with jenkins-swarm 1.22 & Jenkins 1.599. Did not manage to apply the workaround with those versions.
          Hide
          gldalmaso Gustavo Lucena Dalmaso added a comment -

          I was able to workaround it by using commons-loggins-1.1.1 in the swarm-client jar.

          It seems that that is the version jenkins itself is using.

          For the maven build to work I added

          <dependency>
                      <groupId>commons-logging</groupId>
                      <artifactId>commons-logging</artifactId>
                      <version>1.1.1</version>
                  </dependency>

          to the swarm-client pom.xml and the resulting artifact worked correctly on my case.

          Show
          gldalmaso Gustavo Lucena Dalmaso added a comment - I was able to workaround it by using commons-loggins-1.1.1 in the swarm-client jar. It seems that that is the version jenkins itself is using. For the maven build to work I added <dependency> <groupId> commons-logging </groupId> <artifactId> commons-logging </artifactId> <version> 1.1.1 </version> </dependency> to the swarm-client pom.xml and the resulting artifact worked correctly on my case.
          Hide
          dawidmalina Dawid Malinowski added a comment -

          Gustavo Lucena Dalmaso Your patch works for me. I already created pull request https://github.com/jenkinsci/swarm-plugin/pull/24.

          Show
          dawidmalina Dawid Malinowski added a comment - Gustavo Lucena Dalmaso Your patch works for me. I already created pull request https://github.com/jenkinsci/swarm-plugin/pull/24 .
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Dawid Malinowski
          Path:
          client/pom.xml
          http://jenkins-ci.org/commit/swarm-plugin/849e550491366260cc7f8e6b831c7a51155f6982
          Log:
          JENKINS-24149 - LogConfigurationException due to conflicting commons-logging versions

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Dawid Malinowski Path: client/pom.xml http://jenkins-ci.org/commit/swarm-plugin/849e550491366260cc7f8e6b831c7a51155f6982 Log: JENKINS-24149 - LogConfigurationException due to conflicting commons-logging versions
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Peter Jönsson
          Path:
          client/pom.xml
          http://jenkins-ci.org/commit/swarm-plugin/6aaf9453d44a46db3600485cbaba73288c4c960e
          Log:
          Merge pull request #24 from oberthur/master

          JENKINS-24149 - LogConfigurationException

          Compare: https://github.com/jenkinsci/swarm-plugin/compare/704dd97a434b...6aaf9453d44a

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Jönsson Path: client/pom.xml http://jenkins-ci.org/commit/swarm-plugin/6aaf9453d44a46db3600485cbaba73288c4c960e Log: Merge pull request #24 from oberthur/master JENKINS-24149 - LogConfigurationException Compare: https://github.com/jenkinsci/swarm-plugin/compare/704dd97a434b...6aaf9453d44a
          Hide
          mindjiver Peter Jönsson added a comment -

          Released in swarm-plugin-1.23

          Show
          mindjiver Peter Jönsson added a comment - Released in swarm-plugin-1.23
          mindjiver Peter Jönsson made changes -
          Field Original Value New Value
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Kohsuke Kawaguchi [ kohsuke ] Peter Jönsson [ mindjiver ]
          Resolution Fixed [ 1 ]
          Hide
          dalvizu Dan Alvizu added a comment -

          I had a different stacktrace for this issue, if it helps anyone else diagnose the issue. Upgrading to 1.23 fixed the issue.

          My stacktrace occured trying to run a FileCallable on the remote slave:

          java.io.IOException: remote file operation failed: [...]: java.io.InvalidClassException: org.apache.commons.logging.LogConfigurationException; local class incompatible: stream classdesc serialVersionUID = 1571584275865309127, local class serialVersionUID = 8486587136871052495
          	at hudson.FilePath.act(FilePath.java:985)
          	at hudson.FilePath.act(FilePath.java:967)
          	at com.[my_publisher]perform([...my_publisher...].java:105)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:776)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
          	at hudson.model.Build$BuildExecution.post2(Build.java:183)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
          	at hudson.model.Run.execute(Run.java:1763)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:381)
          Caused by: java.io.InvalidClassException: org.apache.commons.logging.LogConfigurationException; local class incompatible: stream classdesc serialVersionUID = 1571584275865309127, local class serialVersionUID = 8486587136871052495
          	at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:617)
          	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1622)
          	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
          	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
          	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
          	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
          	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
          	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
          	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
          	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
          	at hudson.remoting.UserRequest.deserialize(UserRequest.java:185)
          	at hudson.remoting.UserResponse.retrieve(UserRequest.java:218)
          	at hudson.remoting.Channel.call(Channel.java:753)
          	at hudson.FilePath.act(FilePath.java:978)
          
          Show
          dalvizu Dan Alvizu added a comment - I had a different stacktrace for this issue, if it helps anyone else diagnose the issue. Upgrading to 1.23 fixed the issue. My stacktrace occured trying to run a FileCallable on the remote slave: java.io.IOException: remote file operation failed: [...]: java.io.InvalidClassException: org.apache.commons.logging.LogConfigurationException; local class incompatible: stream classdesc serialVersionUID = 1571584275865309127, local class serialVersionUID = 8486587136871052495 at hudson.FilePath.act(FilePath.java:985) at hudson.FilePath.act(FilePath.java:967) at com.[my_publisher]perform([...my_publisher...].java:105) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:776) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:381) Caused by: java.io.InvalidClassException: org.apache.commons.logging.LogConfigurationException; local class incompatible: stream classdesc serialVersionUID = 1571584275865309127, local class serialVersionUID = 8486587136871052495 at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:617) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1622) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) at hudson.remoting.UserRequest.deserialize(UserRequest.java:185) at hudson.remoting.UserResponse.retrieve(UserRequest.java:218) at hudson.remoting.Channel.call(Channel.java:753) at hudson.FilePath.act(FilePath.java:978)
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 157024 ] JNJira + In-Review [ 207939 ]

            People

            • Assignee:
              mindjiver Peter Jönsson
              Reporter:
              rkok Rene Kok
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: