I have trouble importing an external jar into my project using a routine.
The problem is I can't use tLibraryLoad because my external jar is meant to evolve. So I don't want to regenerate all the jobs using it every time my external jar changes.
What we did was creating a routine called 'Loader', and this routine uses my external jar.
That works perfectly with the studio. But my job won't generate on TAC because it doesn't seem to load my external jar.
Here is my loader_0.1.properties :
<?xml version="1.0" encoding="UTF-8"?> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:TalendProperties="http://www.talend.org/properties"> <TalendProperties:Property xmi:id="_YJb14CUQEeeUgcsKuAamXA" id="_YJbO0CUQEeeUgcsKuAamXA" label="loader" creationDate="2017-04-19T16:56:32.830+0200" modificationDate="2017-04-19T16:57:29.824+0200$ <author href="../../../talend.project#_B9_TACRCEeeSPKLpifn8vg"/> </TalendProperties:Property> <TalendProperties:ItemState xmi:id="_YJb14SUQEeeUgcsKuAamXA" path="custom"/> <TalendProperties:RoutineItem xmi:id="_YJb14iUQEeeUgcsKuAamXA" property="_YJb14CUQEeeUgcsKuAamXA" state="_YJb14SUQEeeUgcsKuAamXA"> <content href="loader_0.1.item#/"/> <imports xmi:id="_gOZK0CUQEeeUgcsKuAamXA" mESSAGE="common_lib" mODULE="my-external.jar" nAME="loader" rEQUIRED="true" urlPath="/opt/common_lib/my-external.jar"/> </TalendProperties:RoutineItem> </xmi:XMI>
The jar is indeed located in /opt/common_lib/ .
Here is the beginning of my job.java :
package job_externaljar_0_1; import routines.DataOperation; import routines.TalendDataGenerator; import routines.DataQuality; import routines.loader; import routines.Relational; import routines.DataQualityDependencies; import routines.Mathematical;
Am I missing something ?
Is there another way to do what I want to do ?
Thanks for your support.
Solved! Go to Solution.
In studio, right click on routine and select 'Edit routine libraries' option to add external libraries to your routine.
In TAC, open the configuration page and define the User libraries parameters to specify a repository URL for storing all libraries.
I don't know if you have followed the same steps, let me know if the problem still exists.
Thanks for the reply.
I tried that, but it doesn't seem to work.
I've uploaded my external jar in the following directory :
Then I configured the User Libraries in the Configuration page to that exact Nexus Repository.
I linked the very same jar using a routine.
So the job is running quite well on the studio, but won't generate on the TAC, even if my jar is located on the right repository on Nexus.
I restarted the Commande Line to be sure, but it didn't change much.
Have you got an idea ?
The jar should should be loaded automatically to Nexus after you configure the parameters and the dependency libraries are exported also when deploy the job to remote Job server. I have no reasons why you still got the error. Which version of studio are you using? Would you mind sending me the job items and the jar for testing?
Great, thanks for your feedback and sharing the solution.
Can someone please explain why does this issue occur because of nexus configuration and can it be avoided ?
As the Talend job runs locally why does it need nexus to be up , is there any workaround ?
The problem is , in our project it is not uncommon for the nexus server to go down (it would seem strange) , but when that happens we cannot run Talend jobs in our local environment as well.As it gives the error "import data.operation cannot be resolved to a type"
Can this be avoided ?
Did you find a solution/workaround?, We're having the same problem : once the nexus is down or restarted, we cannot build the jobs anymore because Talend is unable to get the internal libraries.
We have errors like : "the import org.apache cannot be resolved"
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema