my context variable is null in the tMysqlInput query

Four Stars

my context variable is null in the tMysqlInput query

Hello!

I have a problem with my job when I want to make a query with 2 context variables. I attached photos with my job and my components and when I run the job, it's giving me this error:

Exception in component tMysqlInput_1 (facebook_amazon_us)
java.lang.NullPointerException
at mava.facebook_amazon_us_0_1.facebook_amazon_us.tWaitForFile_1Process(facebook_amazon_us.java:2058)
at mava.facebook_amazon_us_0_1.facebook_amazon_us.tMysqlConnection_1Process(facebook_amazon_us.java:798)
at mava.facebook_amazon_us_0_1.facebook_amazon_us.runJobInTOS(facebook_amazon_us.java:5363)
at mava.facebook_amazon_us_0_1.facebook_amazon_us.main(facebook_amazon_us.java:5085)

What I want to do in this job: I have a csv file with multiple columns. The first one is called Reporting_Starts. I want to get the first registration from that column and put it in the query for a select like: SELECT * FROM my_table WHERE MONTH(my_table.Reporting_Starts)='"+context.month+"'. I cannot get why my tJava_4 sees the variables and tMysqlInput don't. 

In my tJava_4 I have the following code:

System.out.println(context.month);

 

Please let me know if you need any additional information about the job.

Thanks!

 

Six Stars

Re: my context variable is null in the tMysqlInput query

I think this because of the link between the components. could you please try removing iterate link from tInputFileDelimited_1 and connect javarow1 to java4 with onComponentOK link.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch