Re: Getting "java.io.NotSerializableException" exception in Jenkins pipeline, groovy.

2016-11-14 Thread Donald Morton

Here are some references for you:

https://support.cloudbees.com/hc/en-us/articles/230612967-Pipeline-The-pipeline-even-if-successful-ends-with-java-io-NotSerializableException

https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#serializing-local-variables

https://issues.jenkins-ci.org/browse/JENKINS-35140




On Sunday, November 13, 2016 at 11:13:35 PM UTC-6, Ganesh Kumbhar wrote:
>
> Hello All,
>
> I am new to Jenkins pipeline and recently started to use it for my project 
> build.
>
> So, from Jenkins file I am calling a method from other .groovy file which 
> is simple script having some functions defined and in those functions I am 
> creating antbuilder object -> "@Field AntBuilder antBuilder = new 
> AntBuilder()"
> But the problem is, I am not able to call any ant targets using antbuilder 
> object, simply calling echo using this object like -> " antBuilder.echo 
> 'print 
> statement' "  gives *"NotSerializableException"*exception.
>
> java.io.NotSerializableException: org.apache.tools.ant.taskdefs.Echo
>
>   at 
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
>   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)
>
>
> So please guide me to resolve this problem if anyone had faced this issue 
> or have any idea about it.
> Any help is appreciated!
> Thank you very much!
> Ganesh K.
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2b760da3-e4d8-4da4-a554-dbfca8576d86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting "java.io.NotSerializableException" exception in Jenkins pipeline, groovy.

2016-11-14 Thread Thomas Keller

IIRC objects used in pipelines need to be able to get serialized, because 
the build should be pausable and resumable at any time. Try to refactor the 
AntBuilder object creation and call into a groovy method and annotate this 
method with @NonCPS

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/470eba97-6898-49e8-b273-214bb3cfc1aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting "java.io.NotSerializableException" exception in Jenkins pipeline, groovy.

2016-11-13 Thread Ganesh Kumbhar
Hello All,

I am new to Jenkins pipeline and recently started to use it for my project 
build.

So, from Jenkins file I am calling a method from other .groovy file which 
is simple script having some functions defined and in those functions I am 
creating antbuilder object -> "@Field AntBuilder antBuilder = new 
AntBuilder()"
But the problem is, I am not able to call any ant targets using antbuilder 
object, simply calling echo using this object like -> " antBuilder.echo 'print 
statement' "  gives *"NotSerializableException"*exception.

java.io.NotSerializableException: org.apache.tools.ant.taskdefs.Echo

at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
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)


So please guide me to resolve this problem if anyone had faced this issue 
or have any idea about it.
Any help is appreciated!
Thank you very much!
Ganesh K.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2e399b89-bed9-4ac1-9bfb-fac710d7a39c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.