Re: Plugin execution on a slave

34 views
Skip to first unread message

Mark Adamcin

unread,
Oct 25, 2016, 8:01:41 PM10/25/16
to jenkin...@googlegroups.com
I ran into this recently. It turns out you can't pass an anonymous implementation of MasterToSlaveFileCallable to `call`. It must be a named class.


On Tue, Oct 25, 2016 at 2:29 PM, <andrew...@xtra.co.nz> wrote:

A user has asked me to support running my plugin on a slave but whatever I try I keep getting an “Unable to serialize” exception.  My code is now about as basic as it gets and still failing.  Any ideas?

 

I’m running Jenkins 2.19.1 and my plugin has a Jenkins version dependency of '1.642.3'.

 

 

@Override

public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws IOException, InterruptedException {

    return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {

           private static final long serialVersionUID = -8921104780200640023L;

 

            @Override

            public Boolean call() throws IOException {

                return true;

            }

       });

}

 

 

FATAL: Unable to serialize com.inedo.proget.jenkins.DownloadPackageBuilder$1@10c1200

java.io.IOException: Unable to serialize com.inedo.proget.jenkins.DownloadPackageBuilder$1@10c1200

                at hudson.remoting.UserRequest.serialize(UserRequest.java:201)

                at hudson.remoting.UserRequest.<init>(UserRequest.java:64)

                at hudson.remoting.Channel.call(Channel.java:795)

                at com.inedo.proget.jenkins.DownloadPackageBuilder.perform(DownloadPackageBuilder.java:84)

                at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)

                at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)

                at hudson.model.Build$BuildExecution.build(Build.java:205)

                at hudson.model.Build$BuildExecution.doRun(Build.java:162)

                at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)

                at hudson.model.Run.execute(Run.java:1720)

                at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)

                at hudson.model.ResourceController.execute(ResourceController.java:98)

                at hudson.model.Executor.run(Executor.java:404)

Caused by: java.io.NotSerializableException: com.inedo.proget.jenkins.DownloadPackageBuilder

                at java.io.ObjectOutputStream.writeObject0(Unknown Source)

                at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

                at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

                at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

                at java.io.ObjectOutputStream.writeObject0(Unknown Source)

                at java.io.ObjectOutputStream.writeObject(Unknown Source)

                at hudson.remoting.UserRequest._serialize(UserRequest.java:190)

                at hudson.remoting.UserRequest.serialize(UserRequest.java:199)

                ... 12 more

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6bcb1974-23ca-4c49-8955-efd58cef74fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Oct 26, 2016, 10:29:30 AM10/26/16
to Jenkins Dev
On Tue, Oct 25, 2016 at 8:01 PM, Mark Adamcin <ada...@gmail.com> wrote:
> It turns out you can't pass an anonymous
> implementation of MasterToSlaveFileCallable to `call`. It must be a named
> class.

Specifically a *static* nested class (or top-level class). It is the
synthetic `this$0` field or whatever that is unserializable.
Reply all
Reply to author
Forward
0 new messages