One Star

Tmap null pointer exception

Hello,
I'm using Java TOS 2.4.0.RC1.
I'm using a tWaitForFile to start a mixing a xml File and doing a lookup on DB2 AS400 table.
During the first iteration i have no problem all succeed but the second iteration make a nullpointerException in Tmap.

Exception in component tMap_1
java.lang.NullPointerException
at rfid.rfid_0_1.rfid.tWaitForFile_1Process(rfid.java:2051)
at rfid.rfid_0_1.rfid.tAS400Connection_1Process(rfid.java:261)
at rfid.rfid_0_1.rfid.runJobInTOS(rfid.java:3940)
at rfid.rfid_0_1.rfid.main(rfid.java:3852)
It's seem due to lookup component but i' don't understand why.

Thanks for reply

32 REPLIES
Community Manager

Re: Tmap null pointer exception

Hello ben23
Exception in component tMap_1
java.lang.NullPointerException

1) Make sure your columns are nullable when you define the schema.
2) The NullPointerException indicate there are some null value on lookup table, so you need to deal with the null value on corresponding columns on expression filed of tmap, for example:
row1.name==null?value1:row1.name
3) please read the related 2927
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Tmap null pointer exception

Hi,
Thanks for your reply.
Normally my values cannot be null because the second iteration was maked with the same file and the same value in the lookup table.
It's seem due to lookup table during the loop, because the table was loaded only once.
How can we load the lookup table at each iteration ?
Thanks for reply
ben23
One Star

Re: Tmap null pointer exception

Hi,
Any idea for this problem ?
Thanks for reply,
Ben23
Employee

Re: Tmap null pointer exception

Can you show us metadata of your tMap input tables ?
One Star

Re: Tmap null pointer exception

Hi,
You can find in upload image my configuration for tmap and TWaitForFile component. And the result of the job with the same data xml file and same data table for two iterations.
Thanks for reply,
ben23
Community Manager

Re: Tmap null pointer exception

Hello ben23
I have reproduced your job and checked that it should be a bug on tMap. Can you report a bug on our bugtracker with detailed information?
Thanks for your support!
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Tmap null pointer exception

Hi shong,
Sorry what do you want exactly ?
Should i make a report on this page http://www.talendforge.org/bugs/my_view_page.php ?
And in this case what i should post ?
Thanks for reply,
Ben23
Employee

Re: Tmap null pointer exception

Your error come from an interaction problem between Iterate connection and free memory of lookups.
You can follow the 3966 which describe which modifications could be done from 2.4 RC3 before a definitive solution for 2.5.0.
We are being to find a definitive solution to this problem, in fact we have two choices for the moment:
- empty always lookups data from memory, which implies your error
- does not empty lookups data from memory, which implies that lookups data are accumulated in the different lookups of job
Two workarounds exist:
- comments all free memory/files calls into tMap_end.javajet template
> edit TOS-All-r14257-V2.4.0RC2/plugins/org.talend.designer.components.localprovider_2.4.0.RC2_r14257/components/tMap_end.inc.javajet
> comment lines 91, 111, 115 to keep data in memory and temporary files for next iterations
> tMap_end.javajet have to be modified also, add simply a space and save it to be recompiled
- design your job like :
Job1:
---Iterate---> tRunJob(call of job2)

Job2:
-----------------> tMap -> Output
--Lookup----->
One Star

Re: Tmap null pointer exception

Hi amaumont,
Thanks for your reply.
I try your solution to call my job with a tRunJob and it's worked. But with this solution I haven't a permanent connection, and it's a problem because my job must be in real time.
It's possible to share connection between two jobs ?
Regards,
ben23
Employee

Re: Tmap null pointer exception

Sorry, we can't share variables between jobs for the moment, it will possible a day but I don't know when.
You can wait for the 2.4 RC4 or modify the templates like described above.
amaumont
One Star

Re: Tmap null pointer exception

Ok thanks for your answer.
Regards,
ben23
One Star

Re: Tmap null pointer exception

I have the same problem on Talend 4.0.2, but when I tried to execute the 1st workaround, I saw that the code was already removed in the files.
One Star

Re: Tmap null pointer exception

Hi Everyone,
In my job.in tMap Component am getting null Pointer Exception Error.the error which am getting in my job is :
Exception in component tMap_1
java.lang.NullPointerException
at demo.bagmakers_new_0_1.BagMakers_New.tFileInputExcel_1Process(BagMakers_New.java:13692)
at demo.bagmakers_new_0_1.BagMakers_New.runJobInTOS(BagMakers_New.java:16145)
at demo.bagmakers_new_0_1.BagMakers_New.main(BagMakers_New.java:16016)
disconnected
Job BagMakers_New ended at 09:34 01/02/2012.
Can anyone help me out in resolving this error its urgent...
Thanks in Advance,
Sruthi
One Star

Re: Tmap null pointer exception

Hi Sruthi
You'd better upload screenshots of tMap.
Then we can figure out and fix it.
Regards,
Pedro
One Star

Re: Tmap null pointer exception

I have the exactly the same problem and when I executed the workaround the line of code was removed in the files. This post has been a great help.
One Star

Re: Tmap null pointer exception

Sorry to restart the thread.
But I am getting the same error in Talend 5.3.
Checked the component java file, but I dont find anything to be commented on line 91 and 111.
Please help me to resolve this. This has happened suddenly. I didn't face this issue earlier.
Keyur
One Star

Re: Tmap null pointer exception

We need more info such as map rule. You are probably doing some java processing on a null value in your map rule.
One Star

Re: Tmap null pointer exception

Thanks for the reply.
It is indeed the case. I have rectified it.
One Star

Re: Tmap null pointer exception

Hey,
I am having the same problem too, how do i solve this error ,
even due the records are saved to the database successfully i just dont like seeing this error and i not sure if it might make the job fail in future .
 
Thanks
chidozie
Seventeen Stars

Re: Tmap null pointer exception

You mean you get some NullPointerExceptions ?
There are plenty reasons for getting this. One of the most common reason is to have a tMap with an input flow with numeric nullable columns mapped to numeric NONE nullable columns. Because of the automatic unboxing in Java this could fail if the input value is null.
Please provide a bit more information as "Yes I have the same problem" because I guess you will not habe the same job running like in the original post.
One Star

Re: Tmap null pointer exception

@jlolling thanks for your reply

actually i have a job which picks form a flat file (text file ) and loads into oracle database , when i run the job i normally get these  NullPointerExceptions error   , but if i check the table the record was been loaded successfully .
i am worried that because of these error, the job might fail in the near future 

thanks
Community Manager

Re: Tmap null pointer exception

@jlolling thanks for your reply

actually i have a job which picks form a flat file (text file ) and loads into oracle database , when i run the job i normally get these  NullPointerExceptions error   , but if i check the table the record was been loaded successfully .
i am worried that because of these error, the job might fail in the near future 

thanks

The job will stop if the 'die on error' option is checked on tMap, otherwise, the job will continue to process next record even thought this error occurs, but not all of the records are loaded into database. Anyway, you are necessary to analyse the error and resolve it before you deploy the job to product environment. 
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: Tmap null pointer exception

how can we find at specifically which column and what data inside that is throwing this null pointer exception as i am puzzled and my source has 2 million records and we are populating target by joining  multiple tables. and also how to filter out erroneous data from tmap into any file or any table so that we can modify the data if required
Seventeen Stars

Re: Tmap null pointer exception

Simply check which input column is nullable and is assigned to a none-nullable output column. These are potential assignments causing a NullPointerException.
Four Stars

Re: Tmap null pointer exception

Simply check which input column is nullable and is assigned to a none-nullable output column. These are potential assignments causing a NullPointerException.

my all input columns and all output columns are nullable . i have used MD5 to create hash value and used multiple columns to generate this. can this cause to this exception . how to find out the root cause of this exception. like which columns or what data is leading to this so that i can handle that value.
One Star

Re: Tmap null pointer exception

Hi,
I am having a problem where NullPointerException is not thrown when the Primary keys are null.
I have designed these columns as Not Nullable ,even though I am not getting the error and displaying as NULL in my output file.
can anyone help me in resolving this. The below is my tmap and input schema
One Star

Re: Tmap null pointer exception

I simply wasted 2 days on this issue.Also tried jlollings solution.
But in the end I simply downloaded the output in tlogrow and pasted in the notepad.What I saw were some records in the excel file which I was not able to see with naked eyes.Itried the hidin un hiding option still could not see those records.
Finally I copied the output in tlogrow in a notepad ,removed those unwanted records and then loaded the data ,it ran fine!!
Other ETL tools ran this file fine!!!
Dont know what should I call this,curse or a boon Smiley Tongue
You can refer the same issue I had highlighted here.
https://www.talendforge.org/forum/viewtopic.php?id=48234
Excel experts may help me find these rows!!!Suggestions welcome.
One Star

Re: Tmap null pointer exception

Could be a rule that's causing it as well. Look at the line number of the code in the stack trace and check against code tab to see where the problem is
One Star

Re: Tmap null pointer exception

Thanks janhess2 how can I enable row number on the code tab ?