Sunday 21 February 2016

find and fix Null Pointer exception in tmap

very often you will face null pointer exception in tamp in ta lend job

There could be mainly  two reasons for this error

1 . you are taking input from null able columns and inserting in not null columns.
2. you are applying any java method on the data of the columns which can potentially has nulls values.

 Soln 1 :-as far as 1st is concerned you can very easily find which input column is nullable and if mapped to not null columns then you can directly handle nulls in input  by isnull to get the default value if null came or like this http://talend-training.blogspot.in/2011/12/how-to-handle-null-pointer-exception-in.html.

Soln 2 :- check if you are applying any java method on columns which can be null  these nulls may arise due to left outer or right joins.

first find error data which is failing due to this error by by unchecking die on error option in tmap and map error records in log row and then you can very easily trace what value is causing this null pointer excepction.

let me know if have any confusion

6 comments:

  1. Nice blog its very informative and useful blog thanks for sharing.
    Know more about Talend Training
    Talend Online Training

    ReplyDelete
  2. I'm getting null pointer exception in calculation in expression_builder

    ReplyDelete
  3. row1 and row2 are are joined with leftouterjoin
    and I have used columns from row2 for calculation given to output
    while running job it is giving null pointer exception
    how to solve this

    ReplyDelete
    Replies
    1. what i am suspecting is rows which are not matching between row1 ans row2 is sending null in row2 which you are using for calculation . before calculating handle nulls in the column .

      like row1.Value == null ?0:row1.Value , something like this , you can use other null handling operators for integers

      Delete
  4. ETL: Extract, Transform, and Load (ETL) is a process that involves extracting data from outside sources, transforming it to fit operational needs (sometimes using staging tables), then loading it into the end target database or data warehouse. Talend Training

    ReplyDelete
  5. Could you post the job archives?

    ReplyDelete