Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
RGriveau
Contributor
Contributor

using a resource in a cTalendJob in a route

Hello,

I'm facing an issue when i want to use a resource in a talend job in a route.

I tried to make the job work solo, it does.

But when i put the same job (adapted to a route treatment of course) i get a nullPointerException.

I tried to add the resource into the route, into the route dependencies, it didn't change a thing.

Anyone knows how to do it?

Labels (4)
10 Replies
Anonymous
Not applicable

I'm afraid you will need to give us a lot more information. We'll need to see the job, see how it is configured with the cTalendJob and potentially have an understanding of how you are intending to pass data to the job.

RGriveau
Contributor
Contributor
Author

Yes sure, it was a bit short.

I'm trying to validate json data with java functions.

0695b00000aF9GMAA0.png 

0695b00000aF9F4AAK.png 

0695b00000aF9DOAA0.png 

0695b00000aF9EpAAK.png 

I did put my jsonschema into the resource. My code works fine when i use only a job (see screenshot giving me the data not valid in my json)

0695b00000aF9HFAA0.png 

 

But when i put this job in a route to generate my json based on an entry (data in my tFixedFlowInput)

0695b00000aF9HyAAK.png 

 

cTalendJob is doing the exact same thing as my job previously shown based on a tRouteInput. The cFile contains the same data of the tFixedFlowInput.

So for me the process is exactly the same.

But on the route i get this :

0695b00000aF9KYAA0.png 

 

Anonymous
Not applicable

Ah, I see. Your issue is that your Talend Job will require a tRouteInput and tRouteOutput component to receive and send data back to your Route. At the moment, nothing will be passed into your Job from the Route. There is a brief example of this here....

 

https://help.talend.com/r/en-US/8.0/route/route-scenario

RGriveau
Contributor
Contributor
Author

no, no my job in the route is correctly configured

0695b00000aFBTIAA4.pngMy issue is about the resource in the job that doesn't work when i launch the job from a route

Anonymous
Not applicable

You have a tJava connected at the top, linked to your tPreJob via other libraries. What is that for? I am guessing that it contributes towards the Java you are using to process your JSON. If so, I think you need to get rid of everything at the top and put that into a Routine. You can import your Jars directly into a Routine and therefore do not need to use the tPreJob. A tPreJob should not be used in multi-threaded scenarios.

 

Once you have your Routine, it'll be so much easier to use. In fact, you should be able to convert it to a Bean and use it directly in your Route. But first of all, I would attempt to change what you already have to get it to work with a Routine.

RGriveau
Contributor
Contributor
Author

Thank you for your reply, but it's not answering my question, i'm not talking about multi-thread, just about using a resource into a route that launch a job

 

Anonymous
Not applicable

I was explaining why it won't work. You cannot use the tPreJob functionality in multi-threaded environments. Routes are this sort of environment.

RGriveau
Contributor
Contributor
Author

I did as you said, i still get a NullPointerException when using a resource from the repository

Anonymous
Not applicable

How is your tRouteInput configured? I also notice that you do not have a tRouteOutput, yet you have a cLog in the route that is calling the job.