Wednesday, 13 March 2013

Importing external jar or library files to Talend Open Studio


Talend has rich set of functions and libraries available with in its suite. However, you may want to use libraries provided by data vendor or API vendor e.g. if you want to fetch data from Google Adwords then you may want to include or import the library/jar files provided by Google into Talend.

There are two ways to include or import these external jar and library files.

1. Using tLibraryLoad component.
2. By editing the Routine library.


Using tLibraryLoad Component: tLibraryLoad allows you to import and load  useable Java libraries in a Job.



Provide the path of the library file to be loaded in the Library text box in component properties. This will allow the Talend Job to use the functions of the library files.

This method is used when you only want to use the library in a single Talend Job. As the library or external jar file imported using tLibraryLoad component will be available to only that Talend Job only.

Hence, if you want to use the library or external jar for the other Jobs as well then importing it by editing the Routine library is preferable. 

To import the library jar files using the Routine library, follow the below mentioned steps:

1. Create a custom routine. Right Click on Routines under the Code section in Repository Pane and select Create routine to create a new routine. f you have any other custom routine defined as part of your project then you can skip this step.

Note: We are creating this routine only for editing the routine libraries. This routine will not be used anywhere in the Talend Jobs.

2. Right click the routine created in Step 1 or if you already have a custom routine defined and select Edit Routine Libraries.



3. Click on New on the Import External Library window.

4. Locate the library file using the browse button in the New Module window and click OK.



Now you can use the functions of the external jar or library file in more than one Talend Job.

10 comments:

  1. Thanks Vikram for this nice post. It's good interesting. Do you prepare these yourself?

    ReplyDelete
  2. Yes, I generally write on Topics for which I need to research while developing a Talend Job.

    ReplyDelete
  3. xecution failed : Job compile errors
    At least job "DAStudentAgentJob" has a compile errors, please fix and export again.
    Error Line: 8846
    Detail Message: org.apache.kafka cannot be resolved to a type
    There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.
    I saw in code I got two error like
    <org.apache.kafka.clients.consumer
    org.apache.kafka.clients.producer.KafkaProducer
    when I saw code in studio I got error here
    <org.apache.kafka.clients.consumer
    org.apache.kafka.clients.producer.KafkaProducer

    ReplyDelete
  4. I am getting this error .please help anyone why is coming

    ReplyDelete
  5. If we include them through routine libraries, are those jar files will be included when the job is publish in tac?

    ReplyDelete
  6. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Apache Kafka, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on in Apache Kafka. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/


    ReplyDelete
  7. How the file can be transferred to Job Server for Remote run.
    My job is running successfully in Local run but when i run in remote mode i face issue.

    ReplyDelete
  8. first you have to make sure the routine is closed.Only then you can do it. Thanks for the post

    ReplyDelete