[JIRA] (JENKINS-61169) Non-Serializable exception thrown on wrong object
Title: Message Title Daniel Beck updated an issue Jenkins / JENKINS-61169 Non-Serializable exception thrown on wrong object Change By: Daniel Beck Component/s: workflow-cps-plugin Component/s: core Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.204705.1582220575000.5736.1582588740231%40Atlassian.JIRA.
[JIRA] (JENKINS-61169) Non-Serializable exception thrown on wrong object
Title: Message Title Matthew Eggers updated an issue Jenkins / JENKINS-61169 Non-Serializable exception thrown on wrong object Change By: Matthew Eggers I am getting an exception when attempting to serialize a groovy Map that I've generated:{code:java}an exception which occurred: in field groovy.lang.Closure.delegate in object Script1$_run_closure1@30d6aac5 in field com. nike.acid. pipeline.configuration.adaptors.AdvancedClientAdaptor.clientConverter in object com. nike.acid. pipeline.configuration.adaptors.AdvancedClientAdaptor@629f71ba in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c17fa09 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1635b321 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@146f27c2 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@19d1436 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1d8bbdc9 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@39c61bdb in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@7ebbe670 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8Caused: java.io.NotSerializableException: Script1 {code}The problem here is, I'm not asking {{AdvancedClientAdaptor}} to persist the {{clientConverter}} field (It has Closures in it). I'm asking it to persist a JsonStringified groovy map. The issue appears to be in the {{AdvanceClientAdaptor}} class I've written. It accepts groovy map that it performs transformations on. Here is a trivial example: {code:java}def Map = [ targetConfig: [ foo: "bar" ], clientConverter: [ foo: { targetConfig, value -> targetConfig['foo'] = value }]] {code} The {{AdvancedClientConverter}} class basically accepts this Map as an input, assigns 2 member property variables to _each_ of the 2 map fields above:{code:java}class AdvancedClientConverter implements Serializable { Map targetConfig Map clientConverter def steps //running groovy instance AdvancedClientConverter(Map converterMap, def steps) { this.clientConverter = converterMap.clientConverter this.targetConfig = converterMap.targetConfig this.steps = steps } def converterOperation() { this.targetConfig.foo = this.clientConverter.foo(this.targetConfig, "baz"); String fileString = JsonOutput.prettyPrint(JsonOutput.toJson(targetConfig))} steps.echo ("final config: ${fileString}") steps.writeFile file: "FinalConfig.text", text: fileString return target }} {code}The above is all invoked in a running Jenkins
[JIRA] (JENKINS-61169) Non-Serializable exception thrown on wrong object
Title: Message Title Matthew Eggers updated an issue Jenkins / JENKINS-61169 Non-Serializable exception thrown on wrong object Change By: Matthew Eggers I am getting an exception when attempting to serialize a groovy Map that I've generated:{code:java}an exception which occurred: in field groovy.lang.Closure.delegate in object Script1$_run_closure1@30d6aac5 in field com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor.clientConverter in object com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor@629f71ba in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c17fa09 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1635b321 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@146f27c2 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@19d1436 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1d8bbdc9 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@39c61bdb in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@7ebbe670 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8Caused: java.io.NotSerializableException: Script1 {code}The problem here is, I'm not asking {{AdvancedClientAdaptor}} to persist the {{clientConverter}} field (It has Closures in it). I'm asking it to persist a JsonStringified groovy map. The issue appears to be in the {{AdvanceClientAdaptor}} class I've written. It accepts groovy map that it performs transformations on. Here is a trivial example: {code:java}def Map = [ targetConfig: [ foo: "bar" ], clientConverter: [ foo: { targetConfig, value -> targetConfig['foo'] = value }]] {code} The {{AdvancedClientConverter}} class basically accepts this Map as an input, assigns 2 member property variables to _each_ of the 2 map fields above:{code:java}class AdvancedClientConverter implements Serializable { Map targetConfig Map clientConverter def steps //running groovy instance AdvancedClientConverter(Map converterMap, def steps) { this.clientConverter = converterMap.clientConverter this.targetConfig = converterMap.targetConfig this.steps = steps } def converterOperation() { this.targetConfig.foo = this.clientConverter.foo(this.targetConfig, "baz"); String fileString = JsonOutput.prettyPrint(JsonOutput.toJson(targetConfig))} steps.echo ("final config: ${fileString}") steps.writeFile file: "FinalConfig.text", text: fileString return target }} {code}The above is all invoked in a running Jenkins
[JIRA] (JENKINS-61169) Non-Serializable exception thrown on wrong object
Title: Message Title Matthew Eggers updated an issue Jenkins / JENKINS-61169 Non-Serializable exception thrown on wrong object Change By: Matthew Eggers I am getting an exception when attempting to serialize a groovy Map that I've generated:{code:java}an exception which occurred: in field groovy.lang.Closure.delegate in object Script1$_run_closure1@30d6aac5 in field com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor.clientConverter in object com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor@629f71ba in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c17fa09 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1635b321 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@146f27c2 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@19d1436 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1d8bbdc9 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@39c61bdb in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@7ebbe670 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@3b2aa9f8Caused: java.io.NotSerializableException: Script1 {code}The problem here is, I'm not asking {{AdvancedClientAdaptor}} to persist the {{clientConverter}} field (It has Closures in it). I'm asking it to persist a JsonStringified groovy map. The issue appears to be in the {{AdvanceClientAdaptor}} class I've written. It accepts groovy map that it performs transformations on. Here is a trivial example: {code:java}def Map = [ targetConfig: [ foo: "bar" ], clientConverter: [ foo: { targetConfig, value -> targetConfig['foo'] = value }]] {code} The {{AdvancedClientConverter}} class basically accepts this Map as an input, assigns 2 member property variables to _each_ of the 2 map fields above:{code:java}class AdvancedClientConverter implements Serializable { Map targetConfig Map clientConverter def steps //running groovy instance AdvancedClientConverter(Map converterMap, def steps) { this.clientConverter = converterMap.clientConverter this.targetConfig = converterMap.targetConfig this.steps = steps } def converterOperation() { this.targetConfig.foo = this.clientConverter.foo(this.targetConfig, "baz"); String fileString = JsonOutput.prettyPrint(JsonOutput.toJson(targetConfig))} steps.echo ("final config: ${fileString}") steps.writeFile file: "FinalConfig.text", text: fileString return target }} {code}The above is all invoked in a running Jenkins
[JIRA] (JENKINS-61169) Non-Serializable exception thrown on wrong object
Title: Message Title Matthew Eggers created an issue Jenkins / JENKINS-61169 Non-Serializable exception thrown on wrong object Issue Type: Bug Assignee: Suresh Kumar Components: core, file-operations-plugin, pipeline-utility-steps-plugin Created: 2020-02-20 17:42 Environment: Jenkins 2.164.1 pipelines-groovy plugin Priority: Major Reporter: Matthew Eggers I am getting an exception when attempting to serialize a groovy Map that I've generated: an exception which occurred: in field groovy.lang.Closure.delegate in object Script1$_run_closure1@30d6aac5 in field com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor.clientConverter in object com.nike.acid.pipeline.configuration.adaptors.AdvancedClientAdaptor@629f71ba in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c17fa09 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1635b321 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@146f27c2 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@19d1436 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@1d8bbdc9 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@39c61bdb in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@7ebbe670 in field