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

Error when building a Maven project on a swarm node

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: swarm-plugin
    • Labels:
    • Environment:
      Jenkins ver. 2.19.1
      Maven 3.3.9
      Swarm plugin 3.3
    • Similar Issues:

      Description

      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
      

        Attachments

          Issue Links

            Activity

            Hide
            kunickiaj Adam Kunicki added a comment -

            Having this same issue, any workaround besides downgrading?

            Show
            kunickiaj Adam Kunicki added a comment - Having this same issue, any workaround besides downgrading?
            Hide
            grahamlyons Graham Lyons added a comment -

            Not that I found, Adam.

            Show
            grahamlyons Graham Lyons added a comment - Not that I found, Adam.
            Hide
            mdelaney Mike Delaney added a comment -

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

            Show
            mdelaney Mike Delaney added a comment - I'm hitting this as well, with Maven 3.3.3. I had to downgrade to work around it.
            Hide
            gtunon 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
            Show
            gtunon 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
            Hide
            br0ch0n 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? 

            Show
            br0ch0n 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? 
            Hide
            grahamlyons Graham Lyons added a comment -

            Hi Peter Jönsson, 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

            Show
            grahamlyons Graham Lyons added a comment - Hi Peter Jönsson , 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
            Hide
            gregoirew 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)

            Show
            gregoirew 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)
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            mindjiver 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.

            Show
            mindjiver 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.
            Hide
            mindrunner 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.

            Show
            mindrunner 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.
            Hide
            drhelmer Geir Engebakken added a comment -

            +1

            Show
            drhelmer Geir Engebakken added a comment - +1
            Hide
            gregoirew 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?

             

            Show
            gregoirew 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?  
            Hide
            art515 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.

            Show
            art515 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.
            Hide
            gregoirew 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.

            Show
            gregoirew 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.
            Hide
            grahamlyons Graham Lyons added a comment -

            Oleg Nenashev, why was greg oire'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.

            Show
            grahamlyons Graham Lyons added a comment - Oleg Nenashev , why was greg oire '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.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Graham Lyons greg oire When we do the security releases, we release *only* the security fixes. I've thougth Peter Jönsson is going to release 3.6 after that, but seem's no. I will spin the release now

            Show
            oleg_nenashev Oleg Nenashev added a comment - Graham Lyons greg oire When we do the security releases, we release * only * the security fixes. I've thougth Peter Jönsson is going to release 3.6 after that, but seem's no. I will spin the release now
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            I have released 3.6 several minutes ago. Please check it

            Show
            oleg_nenashev Oleg Nenashev added a comment - I have released 3.6 several minutes ago. Please check it
            Hide
            art515 Arnold Robert Turdean added a comment - - edited

            The 3.6 contains the fix for this issue?

            Show
            art515 Arnold Robert Turdean added a comment - - edited The 3.6 contains the fix for this issue?
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

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

            Show
            oleg_nenashev Oleg Nenashev added a comment - The fix has been released in Swarm Plugin/Client 3.6. Please reopen if you still see any issue.
            Hide
            art515 Arnold Robert Turdean added a comment -

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

            Show
            art515 Arnold Robert Turdean added a comment - Great, today or tomorrow we will test it, thank you so much!
            Hide
            mindrunner Lukas Elsner added a comment -

            Sweet, thanks for the update
            greg oire 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

            Show
            mindrunner Lukas Elsner added a comment - Sweet, thanks for the update greg oire 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
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Lukas Elsner, 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.

            Show
            oleg_nenashev Oleg Nenashev added a comment - Lukas Elsner , 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.
            Hide
            mindrunner 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.

            Show
            mindrunner 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.
            Hide
            art515 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!

            Show
            art515 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!
            Hide
            oleg_nenashev 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.

            Show
            oleg_nenashev 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.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: