Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
rmcclure
Contributor III
Contributor III

Joblet does not work but code does in Talend Studio

I have a Joblet in a reference project. This joblet opens DB connections, set context variables, writes to logs, closes DB connections etc.


If I:
- Create a standard job
- insert the joblet into the Job
- Run the job
- It fails with a NullPointerException

If I:
- Create a standard job
- copy the contents of the Joblet directly into the standard job
- Run the job
- It completes successfully

 

To make things more bizarre
If I:
- Switch to the reference project
- Create a the same standard job as above
- insert the joblet into the Job
- Run the job
- It completes successfully

If I:
- back in the master project
- run an existing job
- It completes successfully
- remove the joblet from the existing job
- immediately re-insert the joblet and run
- It fails with a NullPointerException

 

This joblet was modified recently and pushed to Github. I have pulled in the change and still have the issue
I have also renamed my workspace and re-pulled all from github.

Any ideas?

Labels (2)
1 Solution

Accepted Solutions
rmcclure
Contributor III
Contributor III
Author

The issue is resolved.

One of the jobs in the master project was working fine using the joblet. If I removed the joblet and replaced it the job no longer worked. There was something wrong with dropping the Joblet into the job. As a last resort I completely removed Talend from my local machine and re-installed from scratch. Afterwards the Job that wasn't working still didn't work, but when I removed the joblet and replaced it in the job it started to work.

View solution in original post

12 Replies
Anonymous
Not applicable

Hi
Can you show us the full stack error message? We need more details to reproduce the issue. Which component throw the NPE error?

Regards
Shong
rmcclure
Contributor III
Contributor III
Author

I posted the error below. The component in error is a tDBInput.

The issue isn't the error as much as the fact that this exact same code works fine if it is placed in the job rather than run from a joblet

 

 

Error is:

Exception in component PrePostJoblet_1_tDBInput_1 (testcycle)
java.lang.NullPointerException
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tDBInput_1Process(testcycle.java:6479)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tDBConnection_1Process(testcycle.java:5535)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tFileInputDelimited_1Process(testcycle.java:5270)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tJava_1Process(testcycle.java:3555)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tSetGlobalVar_1Process(testcycle.java:3423)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tPrejob_1Process(testcycle.java:3256)
at pos.testcycle_0_1.testcycle.runJobInTOS(testcycle.java:32687)
at pos.testcycle_0_1.testcycle.main(testcycle.java:31493)
[FATAL]: pos.testcycle_0_1.testcycle - PrePostJoblet_1_tDBInput_1 null
java.lang.NullPointerException
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tDBInput_1Process(testcycle.java:6479)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tDBConnection_1Process(testcycle.java:5535)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tFileInputDelimited_1Process(testcycle.java:5270)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tJava_1Process(testcycle.java:3555)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tSetGlobalVar_1Process(testcycle.java:3423)
at pos.testcycle_0_1.testcycle.PrePostJoblet_1_tPrejob_1Process(testcycle.java:3256)
at pos.testcycle_0_1.testcycle.runJobInTOS(testcycle.java:32687)
at pos.testcycle_0_1.testcycle.main(testcycle.java:31493)

Anonymous
Not applicable

Do you create the DB connection on tDBInput component or use an existing DB connection? I guess it is trying to use an existing DB connection, but the DB connection does not exist and causes the error.
Which version of studio are you using? We will test if it is a bug.

Regards
Shong
rmcclure
Contributor III
Contributor III
Author

I am using Studio 7.2.1.
I am using a tDBConnection prior to using the tDBInput. I agree that the connection dosn't exist but the real question is: Why does the code work fine when placed inside the job but not when called from a joblet?

Anonymous
Not applicable

You say that the joblet works when used in a job created in your reference project. This points to maybe there being some metadata that the components in the joblet rely on, being in the reference project but not referenced in the project you are trying this in. 

rmcclure
Contributor III
Contributor III
Author

Thanks for your response.

I understand what you are saying but if the metadata is in the reference project Why does the code work in the master project if I copy from the joblet and paste in a master project job? It still needs to reference the metadata from the reference project.

rmcclure
Contributor III
Contributor III
Author

The issue is resolved.

One of the jobs in the master project was working fine using the joblet. If I removed the joblet and replaced it the job no longer worked. There was something wrong with dropping the Joblet into the job. As a last resort I completely removed Talend from my local machine and re-installed from scratch. Afterwards the Job that wasn't working still didn't work, but when I removed the joblet and replaced it in the job it started to work.

Anonymous
Not applicable

My thinking was that the metadata when you added the components to your job (not in the joblet) was set to built-in. However, it sounds like you have it sorted now. This is very strange behaviour and needs to be investigated. Since you are using joblets you clearly have the subscription product. Would you mind raising this with support? Thanks

rmcclure
Contributor III
Contributor III
Author

I did raise this issue with support. They just sent me a link to this discussion.