Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am having an issue using a dynamic job. I was able to create a small test job to demonstrate the bug. The bug occurs when you have a 3 tier job where the parent job calls child job 1 and child job 1 calls child job 2. Child job 1 must contain 2 job calls with at least 1 being dynamic.
The images above are the parent job and child 1 job. As you can see, child 1 has a dynamic job call. The tJava_1 element just sets context.jobName = "childJob_2". You can see the settings of tRunJob_1 in the 2nd image. If you run the parent job in talend when it is first launched, it does generate an error:
Error: Could not find or load main class cdr_import_project.childjob_2_0_1.childJob_2
Caused by: java.lang.ClassNotFoundException: cdr_import_project.childjob_2_0_1.childJob_2
If you then go and manually run childJob_2 then re-run the parent job, it works fine. If you run it in Windows using the batch file generated from the build without executing through talend, it always generates the ClassNotFoundException error no matter what. If you remove the dynamic job option and run it, the error no longer occurs.
Keep in mind that this is just a simple job I put together to demonstrate the bug as the jobs I am running where I am encountering the error are very complex.
Please let me know if anyone else is running into this issue and if it is something I am doing wrong.
Thanks,
Mike Archipley
Hello,
Could you please give us more information and description about your 3 Tier Job?
The Dynamic Job option is designed to run the child job dynamically, you have to define a context variable and set a default value with job name, the job name can be changed at run time. If you want all the jobs to run sequentially, write all the job names in a file or store them in DB, read the job names from a file or DB, and then iterate each job name and pass it to the context variable.
Best regards
Sabrina
Hello,
Thank you for the prompt response. My 3 tier job consists of a parent job that calls a child. The parent passes some parameters to the child and the child job examines some parameters and will either call the dynamic job or make a call back to the parent job (static job). As you can see in the screen captures provided on my initial post, I was able to replicate the issue by just creating a small demonstration job. The main job contains a tRunJob that calls a job with a job name of childJob_1. In childJob_1, I have a tJava_1 component that sets the context variable for the job name using the following line of code: context.jobName = "childJob_2";
The tJava_1 in childJob_1 has an OnComponentOk that links to the dynamic job tRunJob_1. tRunJob_1 has the "Use Dynamic Job" option checked with "context.jobName" entered into the context job field. There is only 1 job selected in the list called "childJob_2". Since I set context.jobName in tJava_1 to "childJob_2", I would not expect there to be an issue but it always fails with a ClassNotFoundException. Here is the output produced from the command prompt when I execute the bat file in Windows:
c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest>jobbugtest_run.bat
c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest>c:
c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest>cd c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest\
c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest>java -Dtalend.component.manager.m2.repository=c:\Talend\RunJobs\jobBugTest_0.1\jobBugTest/../lib -Xms2048M -Xmx8192M -cp classpath.jar; cdr_import_project.jobbugtest_0_1.jobBugTest --context=Default
running child job 1
Exception in component tRunJob_1 (childJob_1)
java.lang.RuntimeException: Child job returns 1. It doesn't terminate normally.
Error: Could not find or load main class cdr_import_project.childjob_2_0_1.childJob_2
Caused by: java.lang.ClassNotFoundException: cdr_import_project.childjob_2_0_1.childJob_2
at cdr_import_project.childjob_1_0_1.childJob_1.tRunJob_1Process(childJob_1.java:798)
at cdr_import_project.childjob_1_0_1.childJob_1.tJava_1Process(childJob_1.java:480)
at cdr_import_project.childjob_1_0_1.childJob_1.runJobInTOS(childJob_1.java:1610)
at cdr_import_project.childjob_1_0_1.childJob_1.runJob(childJob_1.java:1468)
at cdr_import_project.jobbugtest_0_1.jobBugTest.tRunJob_1Process(jobBugTest.java:642)
at cdr_import_project.jobbugtest_0_1.jobBugTest.tJava_1Process(jobBugTest.java:449)
at cdr_import_project.jobbugtest_0_1.jobBugTest.runJobInTOS(jobBugTest.java:982)
at cdr_import_project.jobbugtest_0_1.jobBugTest.main(jobBugTest.java:832)
Exception in component tRunJob_1 (jobBugTest)
java.lang.RuntimeException: Child job running failed.
java.lang.RuntimeException: Child job returns 1. It doesn't terminate normally.
Error: Could not find or load main class cdr_import_project.childjob_2_0_1.childJob_2
Caused by: java.lang.ClassNotFoundException: cdr_import_project.childjob_2_0_1.childJob_2
at cdr_import_project.jobbugtest_0_1.jobBugTest.tRunJob_1Process(jobBugTest.java:659)
at cdr_import_project.jobbugtest_0_1.jobBugTest.tJava_1Process(jobBugTest.java:449)
at cdr_import_project.jobbugtest_0_1.jobBugTest.runJobInTOS(jobBugTest.java:982)
at cdr_import_project.jobbugtest_0_1.jobBugTest.main(jobBugTest.java:832)
Please let me know if you need any further details. I can also an export of the job if you would like since it was just a small job I created to demonstrate the issue I am running into. I have tested and gotten the same results on Talend version 7.0.1 and 7.1.1.
Best Regards,
Mike