Hi,

We can read "doWriteObject(BlockMarshaller.java:65)"
We then can suppose plugins are not serializable object.
So, try to encapsulate your code in a groovy function, with the
annotation @NonCPS




On Sat, Dec 19, 2020 at 6:44 PM zil...@gmail.com <zill...@gmail.com> wrote:

> I have the following line in my pipeline to get the currently installed
> plugins.
>
> def plugins =
> jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
>
> and it dumps the following. Any ideas why? I can run the code in the
> Scripts console.
>
> an exception which occurred: in field
> com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object
> com.cloudbees.groovy.cps.impl.BlockScopeEnv@2fa84c51 in field
> com.cloudbees.groovy.cps.impl.CallEnv.caller in object
> com.cloudbees.groovy.cps.impl.FunctionCallEnv@f687179 in field
> com.cloudbees.groovy.cps.Continuable.e in object
> org.jenkinsci.plugins.workflow.cps.SandboxContinuable@41cd7240 in field
> org.jenkinsci.plugins.workflow.cps.CpsThread.program in object
> org.jenkinsci.plugins.workflow.cps.CpsThread@13c12346 in field
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4ce8aeb3 in object
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4ce8aeb3 Caused:
> java.io.NotSerializableException: hudson.PluginWrapper at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
> 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:344) at
> java.util.concurrent.CopyOnWriteArrayList.writeObject(CopyOnWriteArrayList.java:973)
> 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
> org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
> at
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:781)
> 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:344) at
> java.util.HashMap.internalWriteEntries(HashMap.java:1793) at
> java.util.HashMap.writeObject(HashMap.java:1363) at
> sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
> at
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> 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:344) at
> java.util.concurrent.ConcurrentSkipListMap.writeObject(ConcurrentSkipListMap.java:1437)
> at sun.reflect.GeneratedMethodAccessor402.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
> at
> org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
> at
> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
> 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.lambda$writeObject$0(RiverWriter.java:144)
> at
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:237)
> at
> org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:552)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:529)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:516)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:440)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
> at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
> at
> org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
> hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
> at
> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
> at
> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
> 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:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
>
> Finished: FAILURE
>
>
> --
> 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/ff23cc35-171c-4bfe-8b7f-8818973fd531n%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/ff23cc35-171c-4bfe-8b7f-8818973fd531n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Yannick LACAUTE
Consultant indépendant
39 rue de Wattignies, 75012 Paris
Tel : 06 16 85 95 76

-- 
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/CAG1W_AzPqAbM7aUvehKMwQWWSwuEM4EqaOXC51_vAJjiS7ryNg%40mail.gmail.com.

Reply via email to