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

Pipeline withMaven Failed to serialize on agent

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: pipeline-maven-plugin
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      Hi,

      I have a pipeline that runs fine when scheduled on an agent:

      node {
        try {
          stage('Checkout') {
            checkout scm
            checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
          }
          currentBuild.result = 'SUCCESS'
        } catch (e) {
          currentBuild.result = 'FAILURE'
          throw e
        } finally {
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
        }
      }
      

      but when I use withMaven, I get an Exception:

      node {
        try {
          stage('Checkout') {
            checkout scm
            checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
          }
          stage('Test') {
            withMaven(jdk: 'default', maven: 'default') {
              sh "mvn clean test"
            }
            step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml'])
          }
          currentBuild.result = 'SUCCESS'
        } catch (e) {
          currentBuild.result = 'FAILURE'
          throw e
        } finally {
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
        }
      }
      

      Exception

      java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag#actions for class org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
      	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
      	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
      	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
      	at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
      	at hudson.XmlFile.write(XmlFile.java:178)
      	at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
      	at java.util.AbstractList.add(AbstractList.java:108)
      	at hudson.model.Actionable.addAction(Actionable.java:129)
      	at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
      	at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
      	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      	at WorkflowScript.run(WorkflowScript:8)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      	at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	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)
      Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.actions.ErrorAction#error for class org.jenkinsci.plugins.workflow.actions.ErrorAction
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
      	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
      	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
      	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
      	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
      	at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
      	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
      	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
      	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
      	at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
      	at hudson.XmlFile.write(XmlFile.java:178)
      	at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
      	at java.util.AbstractList.add(AbstractList.java:108)
      	at hudson.model.Actionable.addAction(Actionable.java:129)
      	at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
      	at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
      	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      	... 29 more
      Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons
      	at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
      	... 80 more
      Finished: FAILURE
      

      The pipeline runs successfully when scheduled on the master.

        Attachments

          Issue Links

            Activity

            michaelwittig Michael Wittig created issue -
            michaelwittig Michael Wittig made changes -
            Field Original Value New Value
            Description Hi,

            I have a pipeline that runs fine when scheduled on an agent:

            {code:java}
            node {
              try {
                stage('Checkout') {
                  checkout scm
                  checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
                }
                currentBuild.result = 'SUCCESS'
              } catch (e) {
                currentBuild.result = 'FAILURE'
                throw e
              } finally {
                step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
              }
            }
            {code}

            but when I use withMaven, I get an Exception:

            {code:java}
            node {
              try {
                stage('Checkout') {
                  checkout scm
                  checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
                }
                stage('Test') {
                  withMaven(jdk: 'default', maven: 'default', ) {
                    sh "mvn clean test"
                  }
                  step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml'])
                }
                currentBuild.result = 'SUCCESS'
              } catch (e) {
                currentBuild.result = 'FAILURE'
                throw e
              } finally {
                step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
              }
            }
            {code}

            Exception
            {noformat}
            java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag#actions for class org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
            at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
            at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
            at hudson.XmlFile.write(XmlFile.java:178)
            at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
            at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
            at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
            at java.util.AbstractList.add(AbstractList.java:108)
            at hudson.model.Actionable.addAction(Actionable.java:129)
            at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
            at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
            at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            at WorkflowScript.run(WorkflowScript:8)
            at ___cps.transform___(Native Method)
            at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
            at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
            at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
            at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
            at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
            at com.cloudbees.groovy.cps.Next.step(Next.java:58)
            at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
            at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
            at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
            at java.util.concurrent.FutureTask.run(FutureTask.java:262)
            at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
            at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            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)
            Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.actions.ErrorAction#error for class org.jenkinsci.plugins.workflow.actions.ErrorAction
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
            at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
            at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
            at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
            at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
            at hudson.XmlFile.write(XmlFile.java:178)
            at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
            at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
            at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
            at java.util.AbstractList.add(AbstractList.java:108)
            at hudson.model.Actionable.addAction(Actionable.java:129)
            at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
            at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
            at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            ... 29 more
            Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons
            at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            ... 80 more
            Finished: FAILURE
            {noformat}


            The pipeline runs successfully when scheduled on the master.
            Hi,

            I have a pipeline that runs fine when scheduled on an agent:

            {code:java}
            node {
              try {
                stage('Checkout') {
                  checkout scm
                  checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
                }
                currentBuild.result = 'SUCCESS'
              } catch (e) {
                currentBuild.result = 'FAILURE'
                throw e
              } finally {
                step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
              }
            }
            {code}

            but when I use withMaven, I get an Exception:

            {code:java}
            node {
              try {
                stage('Checkout') {
                  checkout scm
                  checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'templates']], submoduleCfg: [], userRemoteConfigs: [[url: 'github.com:xxx.git', credentialsId: 'xxx']]], poll: true
                }
                stage('Test') {
                  withMaven(jdk: 'default', maven: 'default') {
                    sh "mvn clean test"
                  }
                  step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml'])
                }
                currentBuild.result = 'SUCCESS'
              } catch (e) {
                currentBuild.result = 'FAILURE'
                throw e
              } finally {
                step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'xxx', sendToIndividuals: false])
              }
            }
            {code}

            Exception
            {noformat}
            java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag#actions for class org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
            at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
            at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
            at hudson.XmlFile.write(XmlFile.java:178)
            at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
            at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
            at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
            at java.util.AbstractList.add(AbstractList.java:108)
            at hudson.model.Actionable.addAction(Actionable.java:129)
            at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
            at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
            at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            at WorkflowScript.run(WorkflowScript:8)
            at ___cps.transform___(Native Method)
            at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
            at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
            at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
            at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
            at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
            at com.cloudbees.groovy.cps.Next.step(Next.java:58)
            at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
            at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
            at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
            at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
            at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
            at java.util.concurrent.FutureTask.run(FutureTask.java:262)
            at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
            at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            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)
            Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.actions.ErrorAction#error for class org.jenkinsci.plugins.workflow.actions.ErrorAction
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
            at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
            at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
            at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
            at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
            at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
            at hudson.XmlFile.write(XmlFile.java:178)
            at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
            at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
            at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
            at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
            at java.util.AbstractList.add(AbstractList.java:108)
            at hudson.model.Actionable.addAction(Actionable.java:129)
            at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
            at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
            at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            ... 29 more
            Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons
            at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            ... 80 more
            Finished: FAILURE
            {noformat}


            The pipeline runs successfully when scheduled on the master.
            Hide
            max_allan max allan added a comment -

            I was having a similar error message and problem with withMaven not running on either slave or master.
            Updated all plugins and core Jenkins from 2.21 to 2.23 and it seems to be working.
            The cause is unknown, I'm pretty sure it was working with the old versions of everything...

            Show
            max_allan max allan added a comment - I was having a similar error message and problem with withMaven not running on either slave or master. Updated all plugins and core Jenkins from 2.21 to 2.23 and it seems to be working. The cause is unknown, I'm pretty sure it was working with the old versions of everything...
            Hide
            alobato Alvaro Lobato added a comment -

            Are you sure this is related to withMaven?, see: https://issues.jenkins-ci.org/browse/JENKINS-38122

            Show
            alobato Alvaro Lobato added a comment - Are you sure this is related to withMaven?, see: https://issues.jenkins-ci.org/browse/JENKINS-38122
            Hide
            michaelwittig Michael Wittig added a comment -

            The only thing I know is that without the withMaven it works. I found JENKINS-38122 before opening this issue but the solution to the problem is missing in the ticket.

            I now use a workaround with a docker container to provide maven and it works for me:

            Jenkinsfile

              def environment  = docker.build 'xyz:snapshot'
                environment.inside {
                  stage('Test') {
                    sh "mvn clean test"
                    step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml'])
                  }
                }
            

            Dockerfile

            FROM centos:7.2.1511
            
            RUN yum -y install epel-release
            RUN yum -y install python-pip java-1.8.0-openjdk-devel wget
            
            RUN wget -q -P / http://mirror.dkd.de/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && mkdir /maven/ && tar xzvf /apache-maven-3.3.9-bin.tar.gz -C /maven/ --strip-components=1
            
            ENV MAVEN_HOME=/maven
            ENV PATH=/maven/bin/:$PATH
            ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
            
            RUN groupadd -g 497 jenkins
            RUN adduser -u 498 -g 497 -s /bin/false -d /var/lib/jenkins -c 'Jenkins Continuous Integration Server' jenkins
            USER jenkins
            
            Show
            michaelwittig Michael Wittig added a comment - The only thing I know is that without the withMaven it works. I found JENKINS-38122 before opening this issue but the solution to the problem is missing in the ticket. I now use a workaround with a docker container to provide maven and it works for me: Jenkinsfile def environment = docker.build 'xyz:snapshot' environment.inside { stage( 'Test' ) { sh "mvn clean test" step([$class: 'JUnitResultArchiver' , testResults: 'target/surefire-reports/*.xml' ]) } } Dockerfile FROM centos:7.2.1511 RUN yum -y install epel-release RUN yum -y install python-pip java-1.8.0-openjdk-devel wget RUN wget -q -P / http: //mirror.dkd.de/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && mkdir /maven/ && tar xzvf /apache-maven-3.3.9-bin.tar.gz -C /maven/ --strip-components=1 ENV MAVEN_HOME=/maven ENV PATH=/maven/bin/:$PATH ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk RUN groupadd -g 497 jenkins RUN adduser -u 498 -g 497 -s /bin/ false -d / var /lib/jenkins -c 'Jenkins Continuous Integration Server' jenkins USER jenkins
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            XStream refuses to serialize com.google.inject.CreationException. I have seen it debugging a problem on the Configuration File Provider Plugin.

            The root cause of the problem was hidden by this XStream serialization exception. Maybe we could improve Jenkins / Xstream doing one of the following:

            Show
            cleclerc Cyrille Le Clerc added a comment - XStream refuses to serialize com.google.inject.CreationException . I have seen it debugging a problem on the Configuration File Provider Plugin. The root cause of the problem was hidden by this XStream serialization exception. Maybe we could improve Jenkins / Xstream doing one of the following: Make Jenkins capable of serializing com.google.inject.CreationException so that the root exception is not hidden Add a log message in hudson.util.XStream2.BlacklistedTypesConverter#marshal
            Hide
            cleclerc Cyrille Le Clerc added a comment -
            • The error message if the JDK name is invalid is the expected message: "ERROR: Could not find the JDK installation: default-does-not-exist. Make sure it is configured on the Global Tool Configuration page"
            • The error message if both JDK names and Maven name are invalid is a good message: "ERROR: Could not find the JDK installation: default-does-not-exist. Make sure it is configured on the Global Tool Configuration page"
            • The error message if the Maven name is invalid is the good message: "ERROR: Could not find 'default-does-not-exist' maven installation."
            Show
            cleclerc Cyrille Le Clerc added a comment - The error message if the JDK name is invalid is the expected message: "ERROR: Could not find the JDK installation: default-does-not-exist. Make sure it is configured on the Global Tool Configuration page" The error message if both JDK names and Maven name are invalid is a good message: "ERROR: Could not find the JDK installation: default-does-not-exist. Make sure it is configured on the Global Tool Configuration page" The error message if the Maven name is invalid is the good message: "ERROR: Could not find 'default-does-not-exist' maven installation."
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Michael I get a 404 "This page has been removed!" trying to get the details of your environment on pastebin. Could you share with us details?

            Show
            cleclerc Cyrille Le Clerc added a comment - Michael I get a 404 "This page has been removed!" trying to get the details of your environment on pastebin. Could you share with us details?
            Hide
            vaimr Denis Saponenko added a comment -

            I got an error:

            Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons
            	at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            	... 76 more
            

            when make symlink workspace to another folder

            Show
            vaimr Denis Saponenko added a comment - I got an error: Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84) at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265) at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252) ... 76 more when make symlink workspace to another folder
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Hello Denis,

            We seem to have a problem with the c.g.i.CreationException that gets hidden by the XStream2$BlacklistedTypesConverter and this problem hides the root cause of your problem.

            We are working at fixing the problem with the BlacklistedTypesConverter that hides the the c.g.i.CreationException.

            Can you detail more what is the symlink that cause your failure? Can you provide an "ls -al" of the parent folder ...

            Show
            cleclerc Cyrille Le Clerc added a comment - Hello Denis, We seem to have a problem with the c.g.i.CreationException that gets hidden by the XStream2$BlacklistedTypesConverter and this problem hides the root cause of your problem. We are working at fixing the problem with the BlacklistedTypesConverter that hides the the c.g.i.CreationException. Can you detail more what is the symlink that cause your failure? Can you provide an "ls -al" of the parent folder ...
            vaimr Denis Saponenko made changes -
            Attachment ls.out [ 34455 ]
            vaimr Denis Saponenko made changes -
            Attachment ls.out [ 34455 ]
            vaimr Denis Saponenko made changes -
            Attachment ls.out [ 34456 ]
            Hide
            vaimr Denis Saponenko added a comment -

            ls.out attached.

            Show
            vaimr Denis Saponenko added a comment - ls.out attached.
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Jesse Glick do you think that Pipeline / XStream2$BlacklistedTypesConverter could provide more detailed stack traces in such case?

            More detailed than

            Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.actions.ErrorAction#error for class org.jenkinsci.plugins.workflow.actions.ErrorAction
            	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
            	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
            	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
            	at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
            	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
            	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
            	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
            	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
            	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
            	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
            	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
            	at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
            	at hudson.XmlFile.write(XmlFile.java:178)
            	at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109)
            	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886)
            	at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315)
            	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302)
            	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278)
            	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269)
            	at java.util.AbstractList.add(AbstractList.java:108)
            	at hudson.model.Actionable.addAction(Actionable.java:129)
            	at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120)
            	at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
            	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            	... 29 more
            Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons
            	at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
            	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
            	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
            	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
            	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
            	... 80 more
            
            Show
            cleclerc Cyrille Le Clerc added a comment - Jesse Glick do you think that Pipeline / XStream2$BlacklistedTypesConverter could provide more detailed stack traces in such case? More detailed than Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.actions.ErrorAction#error for class org.jenkinsci.plugins.workflow.actions.ErrorAction at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256) at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138) at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209) at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84) at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265) at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252) at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138) at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209) at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43) at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015) at com.thoughtworks.xstream.XStream.toXML(XStream.java:988) at hudson.XmlFile.write(XmlFile.java:178) at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:109) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:886) at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:315) at org.jenkinsci.plugins.workflow.graph.FlowNode$1.persist(FlowNode.java:302) at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:278) at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:269) at java.util.AbstractList.add(AbstractList.java:108) at hudson.model.Actionable.addAction(Actionable.java:129) at org.jenkinsci.plugins.workflow.cps.FlowHead.markIfFail(FlowHead.java:142) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:211) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:120) at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16) ... 29 more Caused by: java.lang.UnsupportedOperationException: Refusing to marshal com.google.inject.CreationException for security reasons at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:442) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84) at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265) at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252) ... 80 more
            Hide
            jglick Jesse Glick added a comment -

            A newer release of workflow-api already does better. Anyway this is tangential to the root cause here, still TBD.

            Show
            jglick Jesse Glick added a comment - A newer release of workflow-api already does better. Anyway this is tangential to the root cause here, still TBD.
            Hide
            jglick Jesse Glick added a comment -

            Probably a duplicate of the other issue in this component.

            Show
            jglick Jesse Glick added a comment - Probably a duplicate of the other issue in this component.
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Thanks Jesse Glick, you are right, we still need to understand what is the root cause, why the instantiation of the component through Juice failed.

            Show
            cleclerc Cyrille Le Clerc added a comment - Thanks Jesse Glick , you are right, we still need to understand what is the root cause, why the instantiation of the component through Juice failed.
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Jesse Glick you mean a duplicate of JENKINS-39134 ?

            Show
            cleclerc Cyrille Le Clerc added a comment - Jesse Glick you mean a duplicate of JENKINS-39134 ?
            jglick Jesse Glick made changes -
            Link This issue duplicates JENKINS-39134 [ JENKINS-39134 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Duplicate [ 3 ]
            Hide
            gohla Gabriel Konat added a comment -

            We're also running into this issue, but it is not always reproducible. Sometimes, after restarting Jenkins, the exception does not occur any more.
            For example, build http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/88/console failed because of the issue. But after a restart of Jenkins (and no other changes occurred), build http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/89/console from the same job suddenly works.

            Show
            gohla Gabriel Konat added a comment - We're also running into this issue, but it is not always reproducible. Sometimes, after restarting Jenkins, the exception does not occur any more. For example, build http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/88/console failed because of the issue. But after a restart of Jenkins (and no other changes occurred), build http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/89/console from the same job suddenly works.

              People

              • Assignee:
                alobato Alvaro Lobato
                Reporter:
                michaelwittig Michael Wittig
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: