Loading more than one *jar with tLibraryLoad

One Star

Loading more than one *jar with tLibraryLoad

Hi,
I encountered another problem while working with TOS. For my JavaFlex-Code I need to import four *jars and a bunch of dependencies. I thought that it may be solved by putting all *.jar into <TOS installation path>/lib/java and putting a tLibraryLoad component with import-statements in the job.
This did not work, so I checked the path for external libs in perferences. Everything is fine it points to <TOS installation path>/lib/java.
So I tried to load every *jar with tLibraryLoad this only works for one component, after the second and third one is added nothing works anymore. And only the last added *.jar is recognized.
Something like this:
---onSuccess OK ----> ---onSuccess OK ----> --- onSuccess OK ----> ...

I beginning to get crazy. Maybe I should program it all by-hand as my dearest consultant ;-).

Best regards und thanks in advanced,
Danny
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi Danny
This problem has already been reported as bug.
Ref. http://www.talendforge.org/forum/viewtopic.php?id=4280
Thanks
Surya
One Star

Re: Loading more than one *jar with tLibraryLoad

Thanks for the reply.
Is there another way to provide TOS with external libs? I tried to put the jars in the lib/java folder of Talend Open Studio, created a separate user lib in perferences or added a classpath variable there. But after even restarting TOS the classes in that external lib are not resolved.
How do you import external libs to a job?

Thanks,
Danny
One Star

Re: Loading more than one *jar with tLibraryLoad

Same issue as well.
Is there any workaround in the meantime ?
Thank you
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi,
I saw that the bug is resolved. So I tried to download the source for building the responsible class (org.talend.librariesmanager.model.ModulesNeededProvider). But somehow it does not work I get an error from TOS:
An internal error occurred during: "Initialisierung der Generator-Engine wird durchgeführt...".
Unresolved compilation problems:
ModuleNeeded cannot be resolved to a type
Missing code implementation in the compiler

My question is, can someone provide me a nightly build or a intermediate binary from TOS. It would be enough if someone could give me a right compiled version of ModulesNeedeProvider.
Any other workaround would be also appreciated.

Thanks,
Danny
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi,
is there really noone who has to put external libs to their jobs and found a work around for the tLibraryLoad bug? Or build TOS from SVN?

Thanks in advanced,
Danny
One Star

Re: Loading more than one *jar with tLibraryLoad

My workaround was to exit the Studio after adding each new library. The start it again and add another. I had to do it for most of the libraries, but some got added ok.
Now I finally added them all and after another restart this thing actually runs
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi,
the problem is solved with the new release.

Danny
Not applicable

Re: Loading more than one *jar with tLibraryLoad

Hi,
I tried for the first time to use this component with 2 jars, but it seems to work quite randomly (with TOS 3.0.1) and I face the same symptoms (jar is copied to <TOS installation path>/lib/java, but does not appear in the .classpath, or appears and disappears at random, and org.talend.fileprocess cannot not found). Is this issue really fixed?
As a workaround, I tried to put the sources of the jars I use in the project, but I cannot figure out what is the right place to do this (if such a place exists). It works if a put them in .Java/src, but of course they are removed when the project is closed?
By the way, it looks that tLibraryLoad does not work for Job building, but works for runtime dependencies. Indeed I only had to put the source of the package I use directly from the job, but not the dependancies of that package.
Also, wouldn't it be much simplier if there was a directory to put jars in each project, and all jars in that directory would be added to the classpath automatically? Better have too much libs at build/run time than have classpath problems? Once the job is exported, the superfluous jars might still be removed.
One Star

Re: Loading more than one *jar with tLibraryLoad

How do we use external jars in Talend? I am writing functions that use external jars, not able to figure out how to set the external jars in classpath or libraries.

Thanks
One Star

Re: Loading more than one *jar with tLibraryLoad

I'm also interested by the answer...
I've got the same issue (I'd like to use the JODA package, but... don't know how to put the package, and how to invocate it).
Arnaud
Employee

Re: Loading more than one *jar with tLibraryLoad

Hello,
there is two way to use a jar.
1) use a tLibrairyLoad, and set advanced setting by writing java import
it s work only for current job.
2) create a Talend routine,
- import the jar
- write routine class, and methode like samples provide at code/routine/system to use your own package.
your custom functions are available for all project ( with tMap, tRowGenerator ... )
One Star

Re: Loading more than one *jar with tLibraryLoad

Thank you for your answer, but... it doesn't work with the JODA package...
JODA should let me manipulate dates more easily thant today (dates differences, dates + 2 days, etc...). But I tried your suggestion, TOS told me that I can only import a type, not a package...
Employee

Re: Loading more than one *jar with tLibraryLoad

Hello,
i have post a sample routine to Talend Exchange, to use JODA package, retrive it and copy joda-time-1.6.jar to TOS /lib/java

Create your own function in Routine
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi,
How to add multiple jar files at a time in Talend? I have added new routine and imported jar files one by one. But still I am getting error- FilepathNotFound. How can I resolve this issue?
Moderator

Re: Loading more than one *jar with tLibraryLoad

Hi rajashree,
You can use tLibraryLoad component to load the jar at the beginning of job.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Loading more than one *jar with tLibraryLoad

I am getting below NullPointerException while running Talend job-
1585 DEBUG org.apache.activemq.util.ThreadPoolUtils - Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@46c837cd
Exception in component tJavaRow_1
java.lang.NullPointerException
at com.bluecap.core.broker.MessageBroker.parseMessage(MessageBroker.java:57)
at listohis.hl7toxml_0_1.HL7ToXML.tMomInput_1_LoopProcess(HL7ToXML.java:4095)
at listohis.hl7toxml_0_1.HL7ToXML.tLibraryLoad_3Process(HL7ToXML.java:930)
at listohis.hl7toxml_0_1.HL7ToXML.tLibraryLoad_4Process(HL7ToXML.java:851)
at listohis.hl7toxml_0_1.HL7ToXML.tLibraryLoad_5Process(HL7ToXML.java:772)
at listohis.hl7toxml_0_1.HL7ToXML.tLibraryLoad_6Process(HL7ToXML.java:693)
at listohis.hl7toxml_0_1.HL7ToXML.tLibraryLoad_7Process(HL7ToXML.java:614)
at listohis.hl7toxml_0_1.HL7ToXML.runJobInTOS(HL7ToXML.java:6813)
at listohis.hl7toxml_0_1.HL7ToXML.main(HL7ToXML.java:6679)
disconnected
Help needed to resolve above issue..
Moderator

Re: Loading more than one *jar with tLibraryLoad

Hi,
Show us the screenshot of your tjavarow code, is there any compile error in your job.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi,
How I can point the jar in tlibraryload component if the talend server is on linux machine? see the details below:
We have installed talend server on a linux machine but we do development on our windows machine. I am using tLibraryLoad component to load user defined jar files.
In development environment for tLibraryLoad component ( on windows machine ) we can browse through the file location and select the custom jars. This works fine in Microsoft windows environment.
But when we deploy the same code on server ( linux machine ) then how we can give the path for the custom jar file in tLibraryLoad component?
I have placed the jar files in a folder on linux machine but need help to point the custom jar files in tLibraryLoad component.
Regards,
Shivanandan
Moderator

Re: Loading more than one *jar with tLibraryLoad

Hi Shivanandan,
I have given a response in your another forum Forum 31780, would you mind checking it?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Loading more than one *jar with tLibraryLoad

Hi, im having an error on compiling 
error: package org.talend.fileprocess does not exist
i have the dependency
<dependency>
<groupId>org.talend.libraries</groupId>
<artifactId>talend_file_enhanced</artifactId>
<version>6.0.0</version>
</dependency>
but still cant compile the java
Moderator

Re: Loading more than one *jar with tLibraryLoad

Hi kokisho280,
How did you set tlibraryload component? Screenshots of job setting will be preferred.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.