One Star

context parameter in java to TALEND job

hi,
i want to pass one context variable from java code to talend job.The vaue contains path of CSV file.
I want to pass that path value to 'tFileInputDelimited' component and then to MSSQL database.
First 'tFileInputDelimited' is empty but File name/Stream has file path passed from javacode.
Now 'tMap' component is empty.
How to solve this problem?
One more doubt is how can i get context variable 'file_path' (which is defined in java code) in TALEND JOB and set path value to 'File name/Stream' of  ''tFileInputDelimited'' component.
please look into screenshots for better understanding of my problem.
I tr
5 REPLIES
Moderator

Re: context parameter in java to TALEND job

Hi praveen522,
Have you already checked the document about TalendHelpCenter:How to define context variables for a Job?
Why don't you set your file path value in Context view? Did you want to mask your file path in your job by using javacode?
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: context parameter in java to TALEND job

thanks shong for your quick replay.
Yes i need to pass file path from JAVA code  to TALEND job.
You can see in my java code i set filepath value.i need to use that value in my TALEND JOB.
Tell me how can i use file path of java code in TALEND JOB.
One Star

Re: context parameter in java to TALEND job

any update xdshi??
Moderator

Re: context parameter in java to TALEND job

Hi,

I think you have already read this KB article TalendHelpCenter:Calling a Talend Job from an external Java application
We see your code is OK to call the job from eclipse and pass the  new values to context variable.
So now, what is the problem if you run the java code?
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: context parameter in java to TALEND job

hi xdshi,
I think you will understand my problem clearly and identify mistake i made once you go through my new screenshots attached below.
In return i am getting "org.xml.sax.SAXException" in java class(refer screenshot 1).
EXCEPTION:
org.xml.sax.SAXException: Deserializing parameter 'item':  could not find deserializer for type {http://talend.org}ArrayOf_xsd_string.

Have a look at screenshots.Identify the mistake i done here.