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

Error when building a Maven project on a swarm node

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • swarm-plugin
    • Jenkins ver. 2.19.1
      Maven 3.3.9
      Swarm plugin 3.3

      Building a Maven project on a node managed by the swarm plugin generates the stack trace at the bottom of this description.

      The part of most interest appears to be this line:

      Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current c    lass, org/slf4j/LoggerFactory, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type LoggerFactory; used in the signature
      

      I noticed that this commit - f3a9b57cdeb986703f8cefc49b0c208f5e846efc - introduced org.slf4j.jcl-over-slf4j:1.7.22, whereas Maven itself uses version 1.7.5 (https://github.com/apache/maven/blob/maven-3.3.9/pom.xml#L65)

      The Maven plugin lists that package as an exclusion, presumably because of the fragility they mention and because it's provided from elsewhere: https://github.com/jenkinsci/maven-plugin/blob/9807ed59d2f4c15c17485589fca5dd0d5fde3741/pom.xml#L393-L396

      Note that non-Maven builds work just fine.

      $ java -Xmx1024m -cp /var/lib/jenkins/maven32-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/boot/plexus-classworlds-2.5.1.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/conf/logging jenkins.maven3.agent.Maven32Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2 /usr/local/bin/swarm-plugin.jar /var/lib/jenkins/maven32-interceptor.jar /var/lib/jenkins/maven3-interceptor-commons.jar 38918
      <===[JENKINS REMOTING CAPACITY]===>channel started
      ERROR: Failed to parse POMs
      java.io.IOException: Remote call on Channel to Maven [java, -Xmx1024m, -cp, /var/lib/jenkins/maven32-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/boot/plexus-classworlds-2.5.1.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/conf/logging, jenkins.maven3.agent.Maven32Main, /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2, /usr/local/bin/swarm-plugin.jar, /var/lib/jenkins/maven32-interceptor.jar, /var/lib/jenkins/maven3-interceptor-commons.jar, 38918] failed
      	at hudson.remoting.Channel.call(Channel.java:805)
      	at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:161)
      	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:873)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1720)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type LoggerFactory; used in the signature
      	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:306)
      	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
      	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
      	at hudson.maven.Maven3Builder$MavenExecutionListener.<init>(Maven3Builder.java:343)
      	at hudson.maven.Maven3Builder$JenkinsEventSpy.<init>(Maven3Builder.java:195)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:113)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
      	at hudson.remoting.Request$2.run(Request.java:336)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      	at ......remote call to Channel to Maven [java, -Xmx1024m, -cp, /var/lib/jenkins/maven32-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/boot/plexus-classworlds-2.5.1.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2/conf/logging, jenkins.maven3.agent.Maven32Main, /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.2.2, /usr/local/bin/swarm-plugin.jar, /var/lib/jenkins/maven32-interceptor.jar, /var/lib/jenkins/maven3-interceptor-commons.jar, 38918](Native Method)
      	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1433)
      	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
      	at hudson.remoting.Channel.call(Channel.java:797)
      	... 7 more
      channel stopped
      

          [JENKINS-42098] Error when building a Maven project on a swarm node

          Adam Kunicki added a comment -

          Having this same issue, any workaround besides downgrading?

          Adam Kunicki added a comment - Having this same issue, any workaround besides downgrading?

          Graham Lyons added a comment -

          Not that I found, Adam.

          Graham Lyons added a comment - Not that I found, Adam.

          Mike Delaney added a comment -

          I'm hitting this as well, with Maven 3.3.3. I had to downgrade to work around it.

          Mike Delaney added a comment - I'm hitting this as well, with Maven 3.3.3. I had to downgrade to work around it.

          I downgraded maven to 3.0.5 and I could launch the job and compiled: SUCCESS.
          I have tried maven versions:

          • 3.5.0 => ERROR (the same error as @Graham Lyons)
          • 3.3.9 => ERROR (the same error as @Graham Lyons)
          • 3.3.3 => ERROR (the same error as @Graham Lyons)
          • 3.0.5 => SUCCESS

          Guiomar Tuñón added a comment - I downgraded maven to 3.0.5 and I could launch the job and compiled: SUCCESS. I have tried maven versions: 3.5.0 => ERROR (the same error as @Graham Lyons) 3.3.9 => ERROR (the same error as @Graham Lyons) 3.3.3 => ERROR (the same error as @Graham Lyons) 3.0.5 => SUCCESS

          To be clear, the easiest workaround for me at least is to downgrade just the swarm client jar (rather than maven) to 2.2.  Seems to work fine with the master running the v3.4 swarm plugin.  Switching all my maven jobs to freestyle would be a lot a of work.  I also use multiple maven versions.

          Surely the best solution is to just fix/remove the slf4j stuff added into swarm-client? 

          Brandon Rochon added a comment - To be clear, the easiest workaround for me at least is to downgrade just the swarm client jar (rather than maven) to 2.2.  Seems to work fine with the master running the v3.4 swarm plugin.  Switching all my maven jobs to freestyle would be a lot a of work.  I also use multiple maven versions. Surely the best solution is to just fix/remove the slf4j stuff added into swarm-client? 

          Graham Lyons added a comment -

          Hi mindjiver, I was hoping you could help shed some light on this issue.

          I notice that the SL4J JCL dependency was included in this commit - swarm-plugin#f3a9b5 - but I don't see from the commit message why it was included.

          At the moment this is preventing us from upgrading to the latest release because we're not able to build Maven projects.

          Could you give a bit more information about why this was included?

          Thanks,

          Graham

          Graham Lyons added a comment - Hi mindjiver , I was hoping you could help shed some light on this issue. I notice that the SL4J JCL dependency was included in this commit - swarm-plugin#f3a9b5  - but I don't see from the commit message why it was included. At the moment this is preventing us from upgrading to the latest release because we're not able to build Maven projects. Could you give a bit more information about why this was included? Thanks, Graham

          greg oire added a comment -

          Hello,

          The client use commons-net to connect jenkins, create the slave and get a secret key.  Common-net use a logging system. Short version, it is better to have slf4j here. 

          Now we can do some stuff, I pushed the PR https://github.com/jenkinsci/swarm-plugin/pull/54  to fix that (it is ok on my servers)

          greg oire added a comment - Hello, The client use commons-net to connect jenkins, create the slave and get a secret key.  Common-net use a logging system. Short version, it is better to have slf4j here.  Now we can do some stuff, I pushed the PR https://github.com/jenkinsci/swarm-plugin/pull/54   to fix that (it is ok on my servers)

          Code changed in jenkins
          User: Peter Jönsson
          Path:
          .gitignore
          client/pom.xml
          http://jenkins-ci.org/commit/swarm-plugin/44568f3e23b1d3433a0ab86078b2cc8160e906ff
          Log:
          Merge pull request #54 from GregoireW/JENKINS-42098

          JENKINS-42098 - Linkage error

          Compare: https://github.com/jenkinsci/swarm-plugin/compare/71829cae258c...44568f3e23b1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Jönsson Path: .gitignore client/pom.xml http://jenkins-ci.org/commit/swarm-plugin/44568f3e23b1d3433a0ab86078b2cc8160e906ff Log: Merge pull request #54 from GregoireW/ JENKINS-42098 JENKINS-42098 - Linkage error Compare: https://github.com/jenkinsci/swarm-plugin/compare/71829cae258c...44568f3e23b1

          Sorry for the radio silence, but I was on a 2 month leave without access to internet. I will try to release a new version soon here.

          Peter Jönsson added a comment - Sorry for the radio silence, but I was on a 2 month leave without access to internet. I will try to release a new version soon here.

          Lukas Elsner added a comment -

          This has been an issue for over 6 Month now. Is there any ETA when/if we can expect it being fixed? I am migrating away from this dependency now unfortunately, but for some legacy nodes i still have to maintain swarm functionality and i am a little bit scared, that at some point swarm 2.2 builds will stop working with more recent jenkins/jdk versions.

          Lukas Elsner added a comment - This has been an issue for over 6 Month now. Is there any ETA when/if we can expect it being fixed? I am migrating away from this dependency now unfortunately, but for some legacy nodes i still have to maintain swarm functionality and i am a little bit scared, that at some point swarm 2.2 builds will stop working with more recent jenkins/jdk versions.

          +1

          Geir Engebakken added a comment - +1

          greg oire added a comment -

          Hello,

          My PR has been included in lastest version (3.5) so it should be ok. 

          btw, what is your approach when moving away from this dependency?

           

          greg oire added a comment - Hello, My PR has been included in lastest version (3.5) so it should be ok.  btw, what is your approach when moving away from this dependency?  

          The problem occurred by using the following versions as well:

          Jenkins: 2.73.2

          Maven: 3.5.0

          Swarm plugin: 3.5

           

          Please fix the issue, we are not able to build any maven projects on our slaves. Thank you.

          Arnold Robert Turdean added a comment - The problem occurred by using the following versions as well: Jenkins: 2.73.2 Maven: 3.5.0 Swarm plugin: 3.5   Please fix the issue, we are not able to build any maven projects on our slaves. Thank you.

          greg oire added a comment -

          Wtf.... The version has been build by excluding some commit !!  

          my PR is on the master branch, the 3.5 build has been build by branching on commit before mine. It means doing my own build to fix that.

          greg oire added a comment - Wtf.... The version has been build by excluding some commit !!   my PR is on the master branch, the 3.5 build has been build by branching on commit before mine. It means doing my own build to fix that.

          Graham Lyons added a comment -

          oleg_nenashev, why was gregoirew's commit excluded from the 3.5 release? We're already blocked on upgrading to the 3.x releases because of the logging library issues - now we can't take this security update.

          Graham Lyons added a comment - oleg_nenashev , why was gregoirew 's commit excluded from the 3.5 release? We're already blocked on upgrading to the 3.x releases because of the logging library issues - now we can't take this security update.

          Oleg Nenashev added a comment -

          grahamlyons gregoirew When we do the security releases, we release *only* the security fixes. I've thougth mindjiver is going to release 3.6 after that, but seem's no. I will spin the release now

          Oleg Nenashev added a comment - grahamlyons gregoirew When we do the security releases, we release * only * the security fixes. I've thougth mindjiver is going to release 3.6 after that, but seem's no. I will spin the release now

          Oleg Nenashev added a comment -

          I have released 3.6 several minutes ago. Please check it

          Oleg Nenashev added a comment - I have released 3.6 several minutes ago. Please check it

          Arnold Robert Turdean added a comment - - edited

          The 3.6 contains the fix for this issue?

          Arnold Robert Turdean added a comment - - edited The 3.6 contains the fix for this issue?

          Oleg Nenashev added a comment -

          The fix has been released in Swarm Plugin/Client 3.6. Please reopen if you still see any issue.

          Oleg Nenashev added a comment - The fix has been released in Swarm Plugin/Client 3.6. Please reopen if you still see any issue.

          Great, today or tomorrow we will test it, thank you so much!

          Arnold Robert Turdean added a comment - Great, today or tomorrow we will test it, thank you so much!

          Lukas Elsner added a comment -

          Sweet, thanks for the update
          gregoirew I am evaluating Plugins like ECS-Plugin for AWS to replace our in-house developed docker-scaling daemon for Jenkins Slaves. Swarm client is really cool. Unfortunately breaking changes like this maven bug creates a lot of pain in Enterprise businesses like ours. I would love to continue using it, though.

          Cheers
          Lukas

          Lukas Elsner added a comment - Sweet, thanks for the update gregoirew I am evaluating Plugins like ECS-Plugin for AWS to replace our in-house developed docker-scaling daemon for Jenkins Slaves. Swarm client is really cool. Unfortunately breaking changes like this maven bug creates a lot of pain in Enterprise businesses like ours. I would love to continue using it, though. Cheers Lukas

          Oleg Nenashev added a comment -

          mindrunner, as always, any contributions will be appreciated I joined this plugin as a co-maintainer (I maintain Remoting now, and this plugin is frequently on my radars), but I do not have capacity to really work on stabilizing the plugin. Though I will be happy to review and deliver pull requests.

          Oleg Nenashev added a comment - mindrunner , as always, any contributions will be appreciated I joined this plugin as a co-maintainer (I maintain Remoting now, and this plugin is frequently on my radars), but I do not have capacity to really work on stabilizing the plugin. Though I will be happy to review and deliver pull requests.

          Lukas Elsner added a comment -

          oleg_nenashev Cool, I was actually thinking of that. Does swarm have an active maintainer? Is there any documentation on how to get started? Unfortunately, I missed the plugin development workshop on Jenkins World in September.

          Lukas Elsner added a comment - oleg_nenashev Cool, I was actually thinking of that. Does swarm have an active maintainer? Is there any documentation on how to get started? Unfortunately, I missed the plugin development workshop on Jenkins World in September.

          Update: We tested the 3.6 and it seems that it's working fine, thank you again for the fix!

          Arnold Robert Turdean added a comment - Update: We tested the 3.6 and it seems that it's working fine, thank you again for the fix!

          Oleg Nenashev added a comment -

          >Does swarm have an active maintainer? Is there any documentation on how to get started?

          I doubt there is a specific documentation for Swarm plugin. Regarding common plugin development guides, there is a documentation entry point here: https://jenkins.io/participate/code/ . We're migrating our docs to jenkins.io, so now the documentation may be scattered a bit.

          Oleg Nenashev added a comment - >Does swarm have an active maintainer? Is there any documentation on how to get started? I doubt there is a specific documentation for Swarm plugin. Regarding common plugin development guides, there is a documentation entry point here: https://jenkins.io/participate/code/ . We're migrating our docs to jenkins.io, so now the documentation may be scattered a bit.

            mindjiver Peter Jönsson
            grahamlyons Graham Lyons
            Votes:
            8 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: