https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md#serialization-of-local-variables
This is a feature
either create a class with Serializable interface or use 'simple' objects 
instead of Hashmap

вторник, 31 марта 2015 г., 22:58:27 UTC+3 пользователь Adam R. Paul написал:
>
> Hello, 
>
> I'm working on my first workflow job, using Jenkins LTS 1.596.2 & 
> workflow 1.4, and am getting the following error: 
>
> [...] 
> Running: Execute sub-workflows in parallel : Body : End 
> Running: End of Workflow 
> java.io.NotSerializableException: java.util.HashMap$Entry 
> [...] 
>
> I confess I am not yet fluent in groovy, and only passingly familiar 
> with java, so this may be something simple/stupid, but googling around 
> didn't show anything that seemed applicable. 
>
> The relevant except of my workflow is: 
>
> """ 
> def bport_cmds = [:] 
>
> // first determine the RTIs/bugs to backport: 
> node ("gates") { 
>      runscript("01_gen_buglist -s ${SCRIPT_HOME}/../not-in-sru-bugs -u 
> ${SCRIPT_HOME}/../in-update-bugs") 
>      def j = readFile("build.params") 
>      //echo j.toString() 
>      def rti = new JsonSlurper().parseText(j.toString()) 
>
>      // populate map of backport commands to run in parallel 
>      for (Map.Entry<String, List> entry : rti.entrySet()) { 
>          def script = "02_do_backports -r " + entry.getKey() + " -b " 
>          def cnt = 0 
>          for (bug in entry.getValue()) { 
>              if (cnt == 0) { 
>                  script += bug 
>              } else { 
>                  script += "," + bug 
>              } 
>              cnt++ 
>          } 
>          bport_cmds[entry.getKey()] = { echo "Would have run " + script } 
>      } 
>      rti = null 
> } 
>
> echo bport_cmds.toString() 
>
> // run the backports in parallel: 
> parallel bport_cmds 
> bport_cmds = null 
> """ 
>
> Before adding the parallel call, everything works as expected. 
>
> Any ideas? 
>
> The <redacted> console output is: 
>
> """ 
> Started by user anonymous 
> Running: Allocate node : Start 
> Running on <host> in <dir> 
> Running: Allocate node : Body : Start 
> Running: Shell Script 
> <01_genbuglist script output> 
> Running: Read file from workspace 
> Running: Allocate node : Body : End 
> Running: Allocate node : End 
> Running: Print Message 
> [403412:com.cloudbees.groovy.cps.impl.CpsClosure@3d839d, 
> 403850:com.cloudbees.groovy.cps.impl.CpsClosure@1bf9ea2, 
> 402337:com.cloudbees.groovy.cps.impl.CpsClosure@147a2ae] 
> Running: Execute sub-workflows in parallel : Start 
> [403412] Running: Parallel branch: 403412 
> [403850] Running: Parallel branch: 403850 
> [402337] Running: Parallel branch: 402337 
> [403412] Running: Print Message 
> [403412] Would have run 02_do_backports -r 403412 -b 19320107 
> Running: Execute sub-workflows in parallel : Body : End 
> [403850] Running: Print Message 
> [403850] Would have run 02_do_backports -r 403850 -b 19863042,19404161 
> Running: Execute sub-workflows in parallel : Body : End 
> [402337] Running: Print Message 
> [402337] Would have run 02_do_backports -r 402337 -b 17500325 
> Running: Execute sub-workflows in parallel : Body : End 
> Running: End of Workflow 
> java.io.NotSerializableException: java.util.HashMap$Entry 
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>  
>
>      at 
> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>  
>
>      at 
> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>  
>
>      at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) 
>      at java.util.HashMap.writeObject(HashMap.java:1129) 
>      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) 
>      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
>
>      at java.lang.reflect.Method.invoke(Method.java:606) 
>      at 
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>  
>
>      at 
> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>  
>
>      at 
> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>  
>
>      at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) 
>      at java.util.HashMap.writeObject(HashMap.java:1129) 
>      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) 
>      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
>
>      at java.lang.reflect.Method.invoke(Method.java:606) 
>      at 
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>  
>
>      at 
> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>  
>
>      at 
> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>  
>
>      at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) 
>      at java.util.HashMap.writeObject(HashMap.java:1129) 
>      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) 
>      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
>
>      at java.lang.reflect.Method.invoke(Method.java:606) 
>      at 
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
>  
>
>      at 
> org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
>  
>
>      at 
> org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
>  
>
>      at 
> org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
>  
>
>      at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) 
>      at java.util.HashMap.writeObject(HashMap.java:1129) 
>      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) 
>      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
>
>      at java.lang.reflect.Method.invoke(Method.java:606) 
>      at 
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
>  
>
>      at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
>  
>
>      at 
> org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
>  
>
>      at 
> org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:133)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:341)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:325)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:300)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:177)
>  
>
>      at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:175)
>  
>
>      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:111)
>  
>
>      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: an exception which occurred: 
>      in field locals 
>      in field parent 
>      in field capture 
>      in field def 
>      in field locals 
>      in field capture 
>      in field def 
>      in field delegate 
>      in field closures 
>      in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4622d3 
> Finished: FAILURE 
> """ 
>
> Thanks! 
>      Adam 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f601b67f-53d1-4b60-ae6c-b58496771dba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to