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: 
MDouglas1687874333
Contributor III
Contributor III

tJavaflex preventing errors from being shown

I currently am using a db retry policy from https://www.barmartland.com/retry-failed-connections-in-talend/ in order to make sure a db connection is made in an early part of the job so it can be used later. This all works fine but I have noticed that when a component fails elsewhere in the job, it's error message is no longer being shown, and the output from the End section from the flex is being shown instead, which I would rather not have.

Is this due to the way the tJavaflex works, and my lack of knowledge/understanding? A bit of weirdness due to job or code hierarchy? Difference in the way things work between versions? Any thoughts or assistance would be appreciated

EDIT: Added the set-up of the loop. It's slightly different from the one in the link, uses a connection component instead, and has a tDie for when the loop completes without any success.

MDouglas1687874333_0-1720626457037.png

 

Labels (2)
1 Solution

Accepted Solutions
MDouglas1687874333
Contributor III
Contributor III
Author

The component that it is failing on is a tmap which does not have that option. I have found a way to get it to show the errors again by adding "throw e" to the end section of the tmap. I have also created a new job and tested just the loop and a few components outside the subjob the loop is in and I get the same issue.

The test job:

MDouglas1687874333_0-1720773832671.png

I have managed to get it working correctly now. You need to have an onSubJobOk coming from the tLoop, rather than the tjava. This makes the errors that are caused by other components in the job show correctly and prevents the flex from running again. 

MDouglas1687874333_1-1720774645807.png

 

View solution in original post

6 Replies
MDouglas1687874333
Contributor III
Contributor III
Author

To add to this, when looking at it from the "code" view, I see that all the code from the tJavaFlexx is contained within a "tLoop_1Process", which if I am understanding how all this goes together, is what the given subjob is and so should be containing it?

Shicong_Hong
Support
Support

This job design only contains a tDBInput component and used to retry the DB connection for 5 times, if your subjob contains other components, the error occurred on other component will be captured also by the try/catch Java code defined on tJavaFlex. If you want other error shown out, store the query result to memory or temporary file, process the data in next subjob. eg:

tJava-oncomponentok--tLoop--iterate--tJavaFlex--tDBInput--main--tFileOutputDelimited-oncomponentok--tJava

|onsubjobok

tFileInputDelimited--main-->process data

Hope it helps!

Regards

Shicong

MDouglas1687874333
Contributor III
Contributor III
Author

The thing is, I already do have a setup like that, with a onSubJobOk coming after the tjava but it still prevents the errors from being shown? Or am I misunderstanding what you've written?

MDouglas1687874333
Contributor III
Contributor III
Author

So I think I have (maybe?) narrowed down the issue to the "catch (Exception e)" part of the java flex, it seems like it is catching all failures across the job, not just within the subjob it is part of. This seems like a bug, but my knowledge of Java is not that great so I may just be misunderstanding something here

Shicong_Hong
Support
Support

I didn't make a testing, however, please double check if the 'Die on error' option is enable on the component out of the subjob, when enabling, the Java exception will thrown out when an error occurs, the job will stop to execute.

 

MDouglas1687874333
Contributor III
Contributor III
Author

The component that it is failing on is a tmap which does not have that option. I have found a way to get it to show the errors again by adding "throw e" to the end section of the tmap. I have also created a new job and tested just the loop and a few components outside the subjob the loop is in and I get the same issue.

The test job:

MDouglas1687874333_0-1720773832671.png

I have managed to get it working correctly now. You need to have an onSubJobOk coming from the tLoop, rather than the tjava. This makes the errors that are caused by other components in the job show correctly and prevents the flex from running again. 

MDouglas1687874333_1-1720774645807.png