2016-11-05 92 views
0

我的描述符填充兩個列表,我試圖調用與以下的描述:詹金斯getDescriptor()返回NullPointerException異常

ZAPDriverDescriptorImpl zapDriver = getDescriptor();

然後我打電話

zapDriver.getAllFormats()zapDriver.getAllExportFormats())獲得兩個列表。我將它們連接成只有唯一元素的列表。

滿級可以發現on GitHub

的問題是,這個當我(僅主機)運行詹金斯在當地,但是當我做了master-slave,這個代碼將執行的奴隸,碰上工作一個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) 

回答

0

你調用來自從執行Jenkins.getInstance()。它不可用,因爲從機不運行Jenkins實例。

+0

對不起,這是我的第一個插件,'getDescriptor()'調用'Jenkins.getInstance()',那是你說的嗎?有沒有辦法讓奴隸獲取列表信息? – JordanGS