Error Null operation when uploading AdGroupAdOperation using batch processing

58 views
Skip to first unread message

Irfan Ismail

unread,
Aug 15, 2016, 8:27:26 PM8/15/16
to AdWords API Forum
I used adwords batch processing api to create adwords campaign structures. When uploading operations using BatchJobHelper.uploadIncrementalBatchJobOperations I got error Null operation, as bellow :

java.lang.NullPointerException: Null operation
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228) ~[guava-19.0.jar!/:na]
    at com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobMutateRequest.addOperation(BatchJobMutateRequest.java:82) ~[adwords-axis-2.17.0.jar!/:na]
    at com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobMutateRequest.addOperations(BatchJobMutateRequest.java:87) ~[adwords-axis-2.17.0.jar!/:na]
    at com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobHelperImpl.uploadIncrementalBatchJobOperations(BatchJobHelperImpl.java:85) ~[adwords-axis-2.17.0.jar!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_101]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_101]
    at com.google.api.ads.common.lib.utils.AdsUtilityInvocationHandler.handleInvocation(AdsUtilityInvocationHandler.java:46) ~[ads-lib-2.17.0.jar!/:na]
    at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87) ~[guava-19.0.jar!/:na]
    at com.sun.proxy.$Proxy81.uploadIncrementalBatchJobOperations(Unknown Source) ~[na:na]
    at com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobHelper.uploadIncrementalBatchJobOperations(BatchJobHelper.java:65) ~[adwords-axis-2.17.0.jar!/:na]
    at com.kofera.pusher.service.impl.BatchProcessServiceImpl.startBatchProcess(BatchProcessServiceImpl.java:154) ~[classes!/:na]
    at com.kofera.pusher.service.impl.PushBatchServiceImpl.processTask(PushBatchServiceImpl.java:109) [classes!/:na]
    at com.kofera.pusher.service.impl.PushBatchServiceImpl.access$200(PushBatchServiceImpl.java:29) [classes!/:na]
    at com.kofera.pusher.service.impl.PushBatchServiceImpl$1.run(PushBatchServiceImpl.java:72) [classes!/:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_101]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_101]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_101]

I try to upload CampaignOperation and AdGroupOperation separately and its succeed. Only when I try to upload AdGroupAdOperation I got the Null Operation error again.

Here the code how i compose the AdGroupAdOperation :

    private AdGroupAdOperation composeAddOperation(Ad obj) {

        // Compose Operand
        TextAd textAd = new TextAd();
        textAd.setHeadline(obj.getH());
        textAd.setDescription1(obj.getD1());
        textAd.setDescription2(obj.getD2());
        textAd.setDisplayUrl(obj.getDu());
        textAd.setFinalUrls(new String[] { obj.getFu() });
        AdGroupAd adGroupAd = new AdGroupAd();
        adGroupAd.setAdGroupId(obj.getAdGroupOrigId());
        adGroupAd.setAd(textAd);

        // Create operation
        AdGroupAdOperation operation = new AdGroupAdOperation();
        operation.setOperand(adGroupAd);
        operation.setOperator(Operator.ADD);

        return operation;
    }

Please let me now if more information is required.

Thanks,
Irfan

Joyce Lava

unread,
Aug 15, 2016, 11:50:49 PM8/15/16
to AdWords API Forum
Hi Irfan,

Could you please send the complete SOAP request and response and the clientCustomerId used when you encountered the issue? Also, sending the complete code while using the BatchJobHelper.uploadIncrementalBatchJobOperations for uploading the AdGroupAdOperation should help to check the case further. Please make sure to use Reply Privately to Author when sending these information.

Thanks,
Joyce, AdWords API Team

Irfan Ismail

unread,
Aug 16, 2016, 5:28:56 AM8/16/16
to AdWords API Forum
After checking I found out that several operations not build correctly causing entire upload to be failed. After some fix to code this issue is solved.

Thanks,
Irfan

Joyce Lava

unread,
Aug 16, 2016, 6:21:39 AM8/16/16
to AdWords API Forum
Hello Irfan,

Glad to hear that you found the fix.

Best,
Joyce, AdWords API Team
Reply all
Reply to author
Forward
0 new messages