Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
elkhounds
Creator
Creator

Is it possible to alternate between DEV and PROD context variables when calling Talend jobs from external web app?

Greetings,

 

I developed a Java Spring Boot web application that calls Talend jobs.  At this time the application is set to call jobs against the DEV environment only.  The steps are: 1) from Studio, run Build Job, select DEV context scripts, 2) add JARs/new version to Nexus, 3) update pom.xml, 4) manually copy the directory under the exported job folder that stores the context properties files, such as DEV.properties, PROD.properties into the Java application under src/main/resources.  

 

I have a class that injects configuration variables from the DEV profile file and calls the job.

 

job_GL_Master_Ad_Hoc talendJob=new job_GL_Master_Ad_Hoc();
String[] context=new String[] {"--context_param connect_Staging_Port="+port,
"--context_param connect_Staging_Login="+username, and so on...

talendJob.runJob(context);

 

It works great.   However, when I switch to the PROD profile file containing PROD DB, userid, password, etc 

and run the app, it errors out: Exception in thread "Thread-6" java.lang.NoClassDefFoundError: talenddev1/job_gl_refresh_transaction_ad_hoc_0_3/job_GL_Refresh_Transaction_Ad_Hoc
at talenddev1.job_gl_master_ad_hoc_0_3.job_GL_Master_Ad_Hoc.tRunJob_5Process(job_GL_Master_Ad_Hoc.java:1520)
at talenddev1.job_gl_master_ad_hoc_0_3.job_GL_Master_Ad_Hoc$2.run(job_GL_Master_Ad_Hoc.java:4643)
Caused by: java.lang.ClassNotFoundException: talenddev1.job_gl_refresh_transaction_ad_hoc_0_3.job_GL_Refresh_Transaction_Ad_Hoc
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

 

I assume the java.lang.NoClassDefFoundError indicates it cannot find the PROD context variables in the contexts/DEV.properties. 

 

Is it possible to alternate between DEV and PROD context variables when calling Talend jobs? Or do I have to Build a job from Studio and select PROD to go against PROD? And then do the same for DEV when I want to go against DEV?

 

Thanks

Labels (2)
1 Solution

Accepted Solutions
elkhounds
Creator
Creator
Author

Never mind, I got it to work after all.

View solution in original post

2 Replies
elkhounds
Creator
Creator
Author

Never mind, I got it to work after all.

elkhounds
Creator
Creator
Author

Never mind, I got it to work after all.