Five Stars

Import external jar using routines

Hello, 

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Import external jar using routines

Hi Shong, 

 

I finally got the job done.

The problem was simple : I changed the configuration of Nexus from localhost to its DNS and then it works. 

 

Thanks for your time !

5 REPLIES
Community Manager

Re: Import external jar using routines

Hello 

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.

 1.png

 

I don't know if you have followed the same steps, let me know if the problem still exists.

 

Regards

Shong

----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars

Re: Import external jar using routines

Hello Shong,

 

Thanks for the reply.

I tried that, but it doesn't seem to work.

I've uploaded my external jar in the following directory : 

/opt/talend/tac/Artifact-Repository-Nexus-V2.11.3-01/sonatype-work/nexus/storage/talend-custom-libs

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 ?

 

Community Manager

Re: Import external jar using routines

Hi
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?

Regards
Shong

----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars

Re: Import external jar using routines

Hi Shong, 

 

I finally got the job done.

The problem was simple : I changed the configuration of Nexus from localhost to its DNS and then it works. 

 

Thanks for your time !

Community Manager

Re: Import external jar using routines

Great, thanks for your feedback and sharing the solution.

----------------------------------------------------------
Talend | Data Agility for Modern Business