Null pointer error in tmap

Seven Stars

Null pointer error in tmap

Hi Team,

 

Getting error in tmap , i have applied all columns as nullable but have lookups with another tmap. 

 

Please find the attached screenshot of the tmap and the sub job.

 

Thanks,

Gourav


Accepted Solutions
Seven Stars

Re: Null pointer error in tmap

Hi Team,

 

After applying so many changes in tmap still was not able to fix the issue and since I was doing an inner join , I switched the main and lookup which surprisingly solved the issue. 

 

As it was an inner join nothing much affected and the job runs finally Smiley Happy

 

Thanks everyone who helped me to fixing the issue but tmap works really weird at times sounds funny that after switching the main and lookup issue resolved.

 

Thanks,

Gourav

 

 

View solution in original post


All Replies
Employee

Re: Null pointer error in tmap

Hi Gourav,

 

     The issue is happening at tMap42 which means that Null pointer exception is coming from function. There are two functions here.

 

a) the left function at Var section

b) the output filter based on equal condition.

 

To avoid this issue, please add a Null check at the beginning. If the value is null, do not pass the data to the functions. For example,

 

!Relational.ISNULL(Var.var1) && ("SEG").equals.Var.var1

The Null check should be the first function for all verifications in your tMap operation if there is any chance of having null value in input data.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Seven Stars

Re: Null pointer error in tmap

Hi Nikhil,

 

I have handled this in variable still getting the same error. I also tried your expression but no luck still the issue remains same.

 

row78.newColumn5==null?nullSmiley FrustratedtringHandling.LEFT(row78.newColumn5, 3)

 

Thanks,

Gourav

Employee

Re: Null pointer error in tmap

Hi Gourav,

 

     The rule number 1 is that you cannot equate null value to another null. You will have to do it by following way.

 

Relational.ISNULL(row78.newColumn5)?null:StringHandling.LEFT(row78.newColumn5, 3)

I hope this will resolve your issue. Please spare a second to mark the topic as resolved :-) Kudos will be a bonus!

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Seven Stars

Re: Null pointer error in tmap

Hi Nikhil,

 

Tried the above expression too but the error remains same.

Error:

Exception in component tMap_43 (MAGNITUDE_SCRIPT_INDUSINT)
java.lang.Exception: java.lang.NullPointerException
at group_directory.magnitude_script_indusint_0_1.MAGNITUDE_SCRIPT_INDUSINT.tLDAPInput_16Process(MAGNITUDE_SCRIPT_INDUSINT.java:5275)
at group_directory.magnitude_script_indusint_0_1.MAGNITUDE_SCRIPT_INDUSINT.runJobInTOS(MAGNITUDE_SCRIPT_INDUSINT.java:6433)
at group_directory.magnitude_script_indusint_0_1.MAGNITUDE_SCRIPT_INDUSINT.main(MAGNITUDE_SCRIPT_INDUSINT.java:6059)
Caused by: java.lang.NullPointerException
at group_directory.magnitude_script_indusint_0_1.MAGNITUDE_SCRIPT_INDUSINT.tLDAPInput_16Process(MAGNITUDE_SCRIPT_INDUSINT.java:5041)

Employee

Re: Null pointer error in tmap

Hi Gourav,

 

     Please remove the tMap and put a tLogrow to verify various null value components. Add the Null check function wherever needed. Its clearly says the error is Null value issue and the issue is at tMap component.

 

     So put a tLogrow before and after this component for verification. Also add few columns at a time to track the problematic column. There are no easy solutions other than data verification in this case.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Six Stars

Re: Null pointer error in tmap

Hi

 

From the screenshots the error may come in two cases from your job.

1. the variable var1

2. You are concatenating required columns and passing it to the output column DN. Did you verify is there any of the column is getting is null?

 

For point no 1: @nikhilthampi provided the exact check condition to you.

For point no 2: Please check the columns that you are concatenating and apply null handling to those columns as well.

 

Employee

Re: Null pointer error in tmap

@gouravd_7 

 

Are you still facing the issue or whether the details helped you to locate the problem area?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Seven Stars

Re: Null pointer error in tmap

Hi Nikhil,

 

I am still facing the issue as the job has 8 subjobs with multiple lookups in one Sub job seems there is lot of tmap issues which don't exactly pointing to the tmap instead its point to the Input just before the lookup.

 

As all errors are of null pointer and the person who designed the job has not handled it properly everywhere so , I am handling it now.

 

I will post the solution once done with the same. 

 

Thanks for the follow up.

 

Thanks,

Gourav

Eight Stars

Re: Null pointer error in tmap

hi
just give try like this
row78.newColumn5!=null?stringHandling.LEFT(row78.newColumn5, 3):null
Employee

Re: Null pointer error in tmap

Ok @gouravd_7 

 

Its a quite common mistake happens in Talend jobs. Good that you are verifying the entire data flow for null validations.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 

Seven Stars

Re: Null pointer error in tmap

Hi Team,

 

After applying so many changes in tmap still was not able to fix the issue and since I was doing an inner join , I switched the main and lookup which surprisingly solved the issue. 

 

As it was an inner join nothing much affected and the job runs finally Smiley Happy

 

Thanks everyone who helped me to fixing the issue but tmap works really weird at times sounds funny that after switching the main and lookup issue resolved.

 

Thanks,

Gourav

 

 

View solution in original post

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend Cloud Developer Series – Fetching Studio License

This video will help someone new to using Talend Studio get started by connecting to Talend Cloud and fetching the Studio License

Watch Now

Talend Cloud Developer Series - Introduction

The Talend Cloud Developer Series was created to give you a solid foundational understanding of Talend’s Cloud Integration Platform

Watch Now

Talend Cloud Available on Microsoft Azure

An integration platform-as-a-serviceto help enterprises collect, govern, transform, and share data from any data sources

Watch Now