Skip to Content
Sep 02, 2014 at 05:47 AM

MandatoryFieldNullException while creating a job chain


Hi Everyone,

Build version - M33.104.

I'm trying to create a job chain by using a For loop:

//JobA will be in step 1, job B in step 2 so on and always sequential, the array can contain any number of child jobs, and they will always be sequential
String [] str1 = {"ECC_JO_FI_OT_VIM_COLLECTION_AGGREGATION","descr","comment","jobA","jobB"}
int len = str1.length-3;
for (int i=1;i<=len;i++)
                JobChainStep jcs1 = jc.createJobChainStep();
                jcs1.setSequenceNumber(new Long(i));
                jcsOut.println("Sequence number : "+jcs1.getSequenceNumber());
                String name = "Step "+i;
                JobChainCall jcc1 = jcs1.createJobChainCall();
                jcc1.setSequenceNumber(new Long(1));

I get the following error:

JCS-122035: Unable to persist: JCS-MULTI: Modification vetoed: JCS-102074: Field Job Definition on Job 1 (<Job Definition Not Set>) in step Step 1 of Job Chain OTX.ECC_JO_FI_OT_VIM_COLLECTION_AGGREGATION must be specified

When i do a dry run (without persisting) everything is fine, and the output (println inserted to reflect the values of each variables) is exactly how i want it - so this confirms i am passing the correct values.

But when i try to persist, i get the above error and i'm not able to pin point the actual reason for the error.

If i run without the for loop, passing exact values it works, but not when run in a for loop. What am i doing wrong?

Please help me solve this.