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

          Graham Lyons created issue -

          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.
          Alexander Komarov made changes -
          Link New: This issue is duplicated by JENKINS-42898 [ JENKINS-42898 ]

          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
          Graham Lyons made changes -
          Assignee Original: Kohsuke Kawaguchi [ kohsuke ] New: Peter Jönsson [ mindjiver ]

          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)

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

              Created:
              Updated:
              Resolved: