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

com.google.inject.CreationException after resuming build in script {} or withMaven {}

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

      stage("checkout git") {
         // .....
      }
      
      stage("build app") {
        node {
          withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
            sh 'mvn clean install'
        }
      }
      
      stage("deploy app") {
         node {
           withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
             sh 'mvn deploy'
         }
      }
      

      If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

      [Pipeline] {
      [Pipeline] withMaven
      [Pipeline] // withMaven
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] End of Pipeline
      hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:
      
      1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
        at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)
      
      1 error
      	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
      	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
      	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
      	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
      	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
      	at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
      	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
      	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
      	at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
      	at WorkflowScript.run(WorkflowScript:44)
      	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.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	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:163)
      	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:63)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	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:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Finished: FAILURE
      

      All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there is a problem with the maven enviroment created by the "withMavenStep".

        Attachments

          Issue Links

            Activity

            henok Hendrik Brinkmann created issue -
            henok Hendrik Brinkmann made changes -
            Field Original Value New Value
            Description I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
            // .....
            }
            stage("build app") {
            node {
            withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
            sh 'mvn clean install'
            }
            }

            stage("deploy app") {
            node {
            withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
            sh 'mvn deploy'
            }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline will fail with the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there are problem with the maven enviroment created by the "withMavenStep".
            I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline will fail with the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there are problem with the maven enviroment created by the "withMavenStep".
            henok Hendrik Brinkmann made changes -
            Description I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline will fail with the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there are problem with the maven enviroment created by the "withMavenStep".
            I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there are problem with the maven enviroment created by the "withMavenStep".
            henok Hendrik Brinkmann made changes -
            Description I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there are problem with the maven enviroment created by the "withMavenStep".
            I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there is a problem with the maven enviroment created by the "withMavenStep".
            henok Hendrik Brinkmann made changes -
            Description I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git) {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there is a problem with the maven enviroment created by the "withMavenStep".
            I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

            {code}
            stage("checkout git") {
               // .....
            }

            stage("build app") {
              node {
                withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                  sh 'mvn clean install'
              }
            }

            stage("deploy app") {
               node {
                 withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
                   sh 'mvn deploy'
               }
            }
            {code}

            If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

            {code}
            [Pipeline] {
            [Pipeline] withMaven
            [Pipeline] // withMaven
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:

            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)

            1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
            at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
            at WorkflowScript.run(WorkflowScript:44)
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            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:163)
            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:63)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            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:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            {code}

            All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there is a problem with the maven enviroment created by the "withMavenStep".
            henok Hendrik Brinkmann made changes -
            Summary Pipeline fails after restart causesd by parent injector error Pipeline fails after restart caused by parent injector error
            henok Hendrik Brinkmann made changes -
            Summary Pipeline fails after restart caused by parent injector error Pipeline fails after restart caused by Just-in-time binding
            henok Hendrik Brinkmann made changes -
            Labels pipeline
            jglick Jesse Glick made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            jglick Jesse Glick made changes -
            Component/s workflow-step-api-plugin [ 21718 ]
            Labels pipeline
            Assignee Alvaro Lobato [ alobato ]
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-38445 [ JENKINS-38445 ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Summary Pipeline fails after restart caused by Just-in-time binding com.google.inject.CreationException after resuming build in script {} or withMaven {}
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-38605 [ JENKINS-38605 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-34488 [ JENKINS-34488 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "pipeline-model-definition PR 59 (Web Link)" [ 15079 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "pipeline-maven PR 11 (Web Link)" [ 15081 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-step-api PR 14 (Web Link)" [ 15082 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-step-api PR 15 (Web Link)" [ 15087 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-34021 [ JENKINS-34021 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-basic-steps PR 28 (Web Link)" [ 15089 ]
            alobato Alvaro Lobato made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-40161 [ JENKINS-40161 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-37486 [ JENKINS-37486 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-37486 [ JENKINS-37486 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-40909 [ JENKINS-40909 ]
            cleclerc Cyrille Le Clerc made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                henok Hendrik Brinkmann
              • Votes:
                3 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: