Four Stars

Null Pointer Exception

I'm receiving a null pointer exception when I try to use contexts to insert into a log table, but I don't get an error when I use those same contexts in a msgbox.  I use the same insert statement earlier in the job and it works just fine.  Any ideas of what else may be causing the null pointer exception?

 

tJava_4: (Earlier param set)

context.Log_SubJob = "eHub_etificate Insert";
context.Log_Step = "Start Process";

 

tJDBCRow_6: (works)

"Insert into Integration.public.logsteps
(JobName, SubJob,LogStep, LogTime, JobStart)
Values ('"+jobName+"','"+context.Log_SubJob+ "','"+context.Log_Step+ "', '"+TalendDate.getDate("yyyy-MM-dd HH:mm:ss")+"','"+context.Log_StartDateTime_String+"');"

 

tJava_5 (Update Parameters)

context.Log_SubJob = "eHub_Offers Insert";
context.Log_Step = "Start Process";

 

tJDBCRow_8: (Null Pointer Exception Error)

"Insert into Integration.public.logsteps
(JobName, SubJob,LogStep, LogTime, JobStart)
Values ('"+jobName+"','"+context.Log_SubJob+ "','"+context.Log_Step+ "', '"+TalendDate.getDate("yyyy-MM-dd HH:mm:ss")+"','"+context.Log_StartDateTime_String+"');"

 

 

tMsgBox_1 (Works)

jobName+context.Log_SubJob+context.Log_Step+TalendDate.getDate("yyyy-MM-dd HH:mm:ss")+context.Log_StartDateTime_String

Talend Null Pointer Exception components.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: Null Pointer Exception

It is hard to identify this without having the job to look at and seeing what you say. My suspicion is that maybe when you added the context group for a second time you added values with the context variables. If this is the case (and you intend to set them during the job) you may need to check your job.

Rilhia Solutions
6 REPLIES
Fifteen Stars

Re: Null Pointer Exception

Can you post a screenshot showing your complete job AND the full error message? I need be able to see the flow of data through the components. The code you have given looks OK. I suspect that either your job is taking a path which you are not expecting OR (maybe more likely) the error is misleading.

Rilhia Solutions
Four Stars

Re: Null Pointer Exception

Here's the whole job!  A bunch of things are deactivated while I tried to troubleshoot this issue.  I deleted and added in jDBCRow_8 again, and now I'm not getting an error, but it is returning a red null in the middle of the statistics.  It also isn't logging, which is what JDBCRow_8 does.  After that, I again removed JDBCRow_8, and copied and pasted LogSubJobStart below, and got the full error.  Below you'll see what is returned with a new jDBCRow_8, then I pasted the error from a copied and pasted LogSubJobStart.  Following that is a screenshot of the whole job.

 

Thanks for reviewing this!

Claire

 

(After replacing JDBCRow_8)

Starting job TalJb_File_to_Del_Staging_Reference_Files at 11:33 24/04/2018.

[statistics] connecting to socket on port 3466
[statistics] connected
null
[statistics] disconnected
Job TalJb_File_to_Del_Staging_Reference_Files ended at 11:34 24/04/2018. [exit code=0]

 

 

(After copying LogSubJobStart and pasting it to be used instead of tJDBCRow_8)

Exception in component tJDBCRow_8 (TalJb_File_to_Del_Staging_Reference_Files)
java.lang.NullPointerException
at com.snowflake.client.core.SFStatement.execute(SFStatement.java:619)
at com.snowflake.client.jdbc.SnowflakeStatementV1.executeQueryInternal(SnowflakeStatementV1.java:188)
at com.snowflake.client.jdbc.SnowflakeStatementV1.executeQuery(SnowflakeStatementV1.java:86)
at com.snowflake.client.jdbc.SnowflakeStatementV1.execute(SnowflakeStatementV1.java:348)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.tJDBCRow_8Process(TalJb_File_to_Del_Staging_Reference_Files.java:3062)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.tJava_5Process(TalJb_File_to_Del_Staging_Reference_Files.java:2829)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.tJava_4Process(TalJb_File_to_Del_Staging_Reference_Files.java:2187)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.tJDBCConnection_2Process(TalJb_File_to_Del_Staging_Reference_Files.java:3375)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.runJobInTOS(TalJb_File_to_Del_Staging_Reference_Files.java:4020)
at testing.taljb_file_to_del_staging_reference_files_0_1.TalJb_File_to_Del_Staging_Reference_Files.main(TalJb_File_to_Del_Staging_Reference_Files.java:3564)

Talend Null Pointer Exception full job.PNG

Four Stars

Re: Null Pointer Exception

I don't understand why, but this may be okay now.  I rebuilt the job, and I am no longer getting errors.  I copied and pasted the same component text from the job with errors, but this one worked.

 

After I started writing the job that errored I added a context variable in an already used context group, and then dragged that group onto the component to update the values.  I'm pretty sure this worked in other scenarios, and the message box works, which also throws me off, but are there context variable issues if you add something to an existing job?

 

I'm new to Talend, and given the troubleshooting behavior I don't see any logic behind this error.  If there is some, and I missed it, that would be great to know so I don't end up with the same issue later, but for now it looks like I'm okay?

 

Rebuilt job screenshot below.

Claire

 

Talend Null Pointer Exception full job rebuild working.PNG

Fifteen Stars

Re: Null Pointer Exception

Sorry to be a pain but you have not named your code samples. I do not know which component is tJava_4 for example. I need to be able to link the code samples to the job.

Rilhia Solutions
Fifteen Stars

Re: Null Pointer Exception

It is hard to identify this without having the job to look at and seeing what you say. My suspicion is that maybe when you added the context group for a second time you added values with the context variables. If this is the case (and you intend to set them during the job) you may need to check your job.

Rilhia Solutions
Four Stars

Re: Null Pointer Exception

Thanks Rilhia!

I'll leave it be at this point, and hopefully all stays a-ok in the future.  In case anyone is looking for some answers in the future, following is a screenshot of the job with the components labeled.  I'll work on providing details clearer in the future!

Claire

 

Talend Null Pointer Exception full job with labels.png