One Star

issue in trunjob component in talend job

Hi Team,
We are using TOS_Di 5.2.0 to create a job.
In the job we have a tJava component to print out (get) some value from the globalMap, that is already set in some previous component.
The values are getting printed as expected. But when we are use the same tJava component again (second time) to print the same value, it sometimes gives NullPointer exception. Please note, this exception comes once in almost 20 runs, rest of the times its runs as expected.
In between the two tJava component, we have a tTeradataFastExport component, that does some processing. We also have one more tJava component that adds few more variable to globalMap.
PFB the diagrammatic representation of the job,
tJava_1 (to set a value to the globalMap) ------ > tJava_2 (to get the value from globalMap) ------ > tJava_3 (to set few more value to the globalMap) ------ > tTeradataFastExport ------ > tJava_4 (to get the value from globalMap)
Note,
The print statements in tJava_2 & tJava_4 are same, i.e we are not trying to access any value that is added to the map in tJava_3.
We are getting the Null pointer sometimes in tJava_4
Please help me resolve the same, Also suggest if there is a bug or am I going wrong somewhere.
Thanks in advance.
3 REPLIES
Community Manager

Re: issue in trunjob component in talend job

Hi
Which connectors are you using between each component in the job? A screenshot of job will be more helpful for us to point out the problem, and please show us the Java codes on each tJava component.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: issue in trunjob component in talend job

PFB the snap of the job,

Please note, its working properly in tJava_4, but giving the nullPointer exception (at times) in tJava_5.
Code is similar in both tJava_4 & tJava_5. Please find below the same.
long threadId = Thread.currentThread().getId();
System.out.println("Thread ID : "+threadId+" :::: ---Values getting passed to Replication Export job ---Printing it just before tRunJob Call ----");
System.out.println("Thread ID : "+threadId+" :::: Is Empty? : "+globalMap.isEmpty());
System.out.println("Thread ID : "+threadId+" :::: Size : "+globalMap.size());
System.out.println("Thread ID : "+threadId+" :::: a : "+context.a);
System.out.println("Thread ID : "+threadId+" :::: b : "+Integer.parseInt(globalMap.get("b").toString()));
System.out.println("Thread ID : "+threadId+" :::: c : "+Integer.parseInt(globalMap.get("c").toString()));
System.out.println("Thread ID : "+threadId+" :::: d : "+globalMap.get("d").toString());
System.out.println("Thread ID : "+threadId+" :::: e : "+globalMap.get("e").toString());
System.out.println("Thread ID : "+threadId+" :::: f : "+globalMap.get("f").toString());
System.out.println("Thread ID : "+threadId+" :::: g : "+globalMap.get("g").toString());
System.out.println("Thread ID : "+threadId+" :::: h : "+globalMap.get("h").toString());
System.out.println("Thread ID : "+threadId+" :::: i : "+globalMap.get("i").toString());
System.out.println("Thread ID : "+threadId+" :::: j : "+globalMap.get("j").toString());
System.out.println("Thread ID : "+threadId+" :::: k : "+globalMap.get("k").toString());
System.out.println("Thread ID : "+threadId+" :::: l : "+globalMap.get("l").toString());
System.out.println("Thread ID : "+threadId+" :::: m : "+Integer.parseInt(globalMap.get("m").toString()));
System.out.println("Thread ID : "+threadId+" :::: n : "+globalMap.get("n").toString());
System.out.println("Thread ID : "+threadId+" :::: o : "+context.o);
System.out.println("Thread ID : "+threadId+" :::: p : "+context.p);
System.out.println("Thread ID : "+threadId+" :::: q : "+globalMap.get("q").toString());
System.out.println("Thread ID : "+threadId+" :::: r : "+globalMap.get("r").toString());
System.out.println("Thread ID : "+threadId+" :::: s : "+globalMap.get("s").toString());
Community Manager

Re: issue in trunjob component in talend job

Hi
Try to run the job with java debug model to debug the java code on tJava_5 and see which line has the NPE, you may find out the cause why it is null after doing some processing.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business