Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
BooWseR
Contributor
Contributor

Error code 0 despite NullPointerException

Hi Guys,

 

I wrote my own bash script which should call another Talend job when the first one went through without errors.

Now I had a NullPointerException and Talend gave still the exit code 0. Can I change that somehow? How can I make sure at STDOUT or STDERR that the job ran without errors?

 

Best regards,

BooWseR

 

Labels (3)
1 Solution

Accepted Solutions
diazsmiedts
Contributor III
Contributor III

Hi, from the screenshot, I also notice that all components seem linked to the PRE job. Thats usually not how you work with those. You have PRE and POST to handle connections, commit points etc, but your main part is not linked to the PRE or POST components. 

 

This could now trigger all of the processing to be executed as a PRE job part, then fail, then the actual job part is executed but has nothing in it, so completes successfully. 

 

Can you separate the main job processing from the PRE part and try again?

View solution in original post

7 Replies
diazsmiedts
Contributor III
Contributor III

Can you describe your job in more detail or post screenshots of it? If you have a POST job component where you handle errors, or you component that failed in the logging actually did not have to "Die on error" checkbox activated, the job runs in full and only logs your exceptions but does not fail. You can add a trigger on fail, and explicitly link it to a tDie component perhaps?

BooWseR
Contributor
Contributor
Author

Sorry for the late answer. Yes, of course i can go more in detail:

 

Here's a small excerpt from my job.

0683p000009M7pp.png

As you can see, the job consists of several subjobs. If these are necessary for the execution of the main job, the checkbox "Died on error in child process" (dunno the correct spelling in english) is also checked.

Now I get an error in one of these subjobs and the main job aborts. So far, so good. But the problem is that I want to call another job via a shell script if the job went through without problems. For this I use the following code:

 

STATUS="${?}"
if [ ${STATUS} -eq 0 ]; then echo "done!"

Unfortunately the main job doesn't end with error code 1 but with error code 0, so my script thinks the job went through without problems.

 

 

So the output of my job is:

00:07:15,034 WARN  Job_0_11.Job - 1
done!

I get the 1 as output, but the exit code remains the 0 so i get the string "done!". I hope you understand my problem.

Anonymous
Not applicable

Do you have a tPostJob component in your main job? If so, this will be the cause.

BooWseR
Contributor
Contributor
Author

I haven't. But I also just read the article and replied to it:

https://community.talend.com/t5/Design-and-Development/Job-in-Talend-failing-with-exit-code-0/m-p/12...

You already suspected something like that there.

Also the "error" occurs both in Talend itself and on the server as a "standalone" job.

Anonymous
Not applicable

The reason I asked that is that your screenshot shows a tPreJob and the bottom of the job cannot be seen. When people use tPreJob components, they generally use tPostJob components. This is a common cause for this issue. I have not seen this without a tPostJob. Can you recreate this in a test job? If you can, could you post it here so that I can see this?

diazsmiedts
Contributor III
Contributor III

Hi, from the screenshot, I also notice that all components seem linked to the PRE job. Thats usually not how you work with those. You have PRE and POST to handle connections, commit points etc, but your main part is not linked to the PRE or POST components. 

 

This could now trigger all of the processing to be executed as a PRE job part, then fail, then the actual job part is executed but has nothing in it, so completes successfully. 

 

Can you separate the main job processing from the PRE part and try again?

BooWseR
Contributor
Contributor
Author

Sorry for my long response time but I couldn't reproduce the error in a simple job.

 

I took the whole job from a co-worker and unfortunately had no idea why he did it that way. Since this was also my first Talend project, I didn't question it.

 

I've had to rebuild the job anyway, so the problem doesn't occur anymore.

 

Nevertheless thank you very much for your help.