Reputation: 4496
My descriptor populates two lists, i am trying to call the descriptor with the following:
ZAPDriverDescriptorImpl zapDriver = getDescriptor();
then i call
zapDriver.getAllFormats()
and zapDriver.getAllExportFormats())
to obtain the two lists. I concatenate them into list with only the unique elements.
Full class can be found on GitHub
The problem is that this works when i'm running jenkins locally (only on the master) but when i do a master-slave
, this code would execute on the slave and run into a NullPointerException
ERROR: java.lang.NullPointerException
at hudson.model.AbstractDescribableImpl.getDescriptor(AbstractDescribableImpl.java:41)
at com.github.jenkinsci.zaproxyplugin.ZAPDriver.getDescriptor(ZAPDriver.java:2435)
at com.github.jenkinsci.zaproxyplugin.ZAPDriver.deleteReports(ZAPDriver.java:815)
at com.github.jenkinsci.zaproxyplugin.ZAPDriver.executeZAP(ZAPDriver.java:1141)
at com.github.jenkinsci.zaproxyplugin.ZAPBuilder$ZAPDriverCallable.invoke(ZAPBuilder.java:362)
at com.github.jenkinsci.zaproxyplugin.ZAPBuilder$ZAPDriverCallable.invoke(ZAPBuilder.java:1)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2720)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at hudson.remoting.Engine$1$1.run(Engine.java:69)
at java.lang.Thread.run(Thread.java:745)
Upvotes: 0
Views: 619
Reputation: 753
You're calling Jenkins.getInstance()
from a slave executor. It's not available there because slave machines don't run a Jenkins instance.
Upvotes: 1