One Star tpk
One Star

"File Not Found" exception for tFileUnarchive

Hi all,
As a part of my daily job i have to copy files from source directory and paste them in one single directory and process each file at a time and after processing the first file i have to move the processed first file to another directory and remove it from the directory where the file is processed so that it will avoid processing the same file when the loop is repeated. To accomplish all the above mentioned process i have done one job. All the settings are given correctly for each component, but when i run my job an exception is thrown "File Not Found".

But, Literally the file with the name is present in the specified location, i don't understand why i am getting this exception, can any correct me what is wrong in my job and what should be corrected to run my job with out any errors?
I had attached the images of my job and the error which i got while executing my job.
Kindly help me to resolve the problem.
Thanks and Regards,
Pavan
19 REPLIES
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi all,
Any help for the above mentioned problem, Kindly help me with a solution.
Thanks and Regards,
Pavan
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pavan
Finally I find the reason.
Type in ((String)globalMap.get("tFileList_3_CURRENT_FILEPATH")) instead of ((String)globalMap.get("tFileList_3_CURRENT_FILE")) on tFileUnarchive.
Regards,
Pedro
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pedro,
I had tried the way you mentioned it worked, but the primary purpose of my job is to process each single file from the folder containing all files and delete the only single processed file from the source folder and when the loop again executes for the second time the job should process the second file and remove the second file from the source after processing and repeat the same till all the files are completed. How can this be accomplished?
Thanks and Regards,
Pavan
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi,
To accomplish the scenario which i mentioned above i had made some modifications in my job and executed but i am getting an error that file is not present at the specified location, but the file is present. If i uncheck the check box "Generate Error if File Not Found" then the job does not goes further, the loop executes 14 times and does not move further tFileList_3 component. Why is it so? Please correct me how to run my job correctly.
I had attached the images of the newly modified job
Thanks and Regards,
Pavan
One Star

Re: "File Not Found" exception for tFileUnarchive

What is the value of context.filename? (is it the filename or the directory to look for the file?)
One Star

Re: "File Not Found" exception for tFileUnarchive

Try putting "C:\Test" in the direcory field and context.filename+"*.tar.gz" in the file mask.
I think from what I can gather you are trying to use the directory field as directory AND filemask.
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Elvis,
The value of context.filename is comming from tJava where i had declared.
Thanks and Regards,
Pavan
What is the value of context.filename? (is it the filename or the directory to look for the file?)
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Elvis,
I had done the same way you mentioned, it doesn't work, "File not Found" error is coming when i run the job after making the changes which you had specified
Thanks and Regards,
Pavan

Try putting "C:\Test" in the direcory field and context.filename+"*.tar.gz" in the file mask.
I think from what I can gather you are trying to use the directory field as directory AND filemask.
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi all,
Any solution for the above mentioned scenario? Where should i change my job in order to run my job successfully with out errors
Thanks in advance
Thanks and Regards,
Pavan
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi all,
Any Ideas for the above mentioned?
Thanks and Regards,
Pavan
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi all,
Can any one please help with a working solution?
Thanks and Regards,
Pavan
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi
I don't know what you do with tOracleBulkExec.
According to your requirement, you can create a job as below. There is no need to use three tFileList.
Regards,
Pedro
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pedro,
Thanks for the pain you had taken out for doing an example job, I use tOracleBulkexec to process the unarchived file after it is unarchived. The example which you had given is good enough if the source directory i.,e C:/Test had only one zip file, but i have some 14-15 files in the source directory. So let me explain you in a more clear way in step wise manner
1. First i need to take the first file for the first iteration and pass it to tFileUnarchive so that it will unarchive the zip file

2. Now after the tFileUnarchive un-archives the zip file in C:/Extraction directory, now the tOracleBulkExec will process one .tsv file which is unzipped by the tFileUnarchive component.
3. After the tOracleBulkExec process is over now i need to remove the First processed zip file and move it to C:/Imported directory(Which means that all the processed files will be placed in this directory)
4. And also i need to delete the extracted files which are extracted in C:/Extraction (this is because when second file is processed tOracleBulkExec must not process the same files of the First zip file)
The above mentioned process should be iterated in a loop for about 14-15 times.
But the example you had given will not work in a loop. How can this be accomplished to do in a loop for the entire process for each single file at a time?
Thanks and Regards,
Pavan
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pedro,
Any Comments/Update on the above mentioned process of how to do the same process in a loop?
Thanks and Regards,
Pavan
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi all,
Can any one give me a solution for the above mentioned scenario?
Thanks and Regards,
Pavan
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pavan
Sorry for my delay to answer.
According to your description at comment #14, I create a new job.
This time i'm sure it will work fine. I simply use tFileList to loop.
Now there are two tar.gz files(abc.tar.gz and abc2.tar.gz) under C:\Test directory in my local computer.
Loop1: tFileList gets the absolute file path of abc.tar.gz.
tFileUnarchive unzip abc.tar.gz.
Use onComponentOK to trigger tOracleExec.
After finishing tOracleExec, use onComponnetOk to trigger tFileCopy. Copy abc.tar.gz from C:\Test to C:\Imported and remove source file(abc.tar.gz) in C:\Test.
Use tFileList_2 to iterate files under C:\Extraction. Then tFileDelete will delete one.csv.
Loop2 : Start to get abc2.tar.gz.
Regards,
Pedro
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pedro,
I had done the changes which you had mentioned, in fact i had done the job the same way before but the output links which i had given to the components were wrongly given. I had given "Iterate" out put links to all the components earlier in my job. After changing the output links to "OnComponent OK" it worked. So based on this i had few questions
1. What is the difference between Iterate and OnComponent OK?
2. Why does the job failed if i use Iterate in all the components?

And coming back to the job again, the job went on smoothly for small files, but for big files the tFileUnarchive can not extract the files. We had discussed earlier about this in the below mentioned link
http://www.talendforge.org/forum/viewtopic.php?pid=83510#p83510
So i had sent you the download links where the files are up loaded, Could you please take a look at it and give me a solution, the download links are as below
bcbackcountry_2012-04-10.tar.gz... (207.55MB) - Completed
Download: https://sizablesend.com/file/ec3xw3/bcbackcountry_2012_04_10.tar.gz
Short URL: http://twelio.com/zyrqmt

bcsteepandcheap_2012-04-10.tar.gz... (194.49MB) - Completed
Download: https://sizablesend.com/file/2s5fi2/bcsteepandcheap_2012_04_10.tar.gz
Short URL: http://twelio.com/izjgn6
I also attach the error which i am getting when i am using big files to extract. My development environment is as below
TOS:5.0.1
OS: Windows Server 2008 R2 data center
RAM: 8GB

Hi Pavan
Sorry for my delay to answer.
According to your description at comment #14, I create a new job.
This time i'm sure it will work fine. I simply use tFileList to loop.
Now there are two tar.gz files(abc.tar.gz and abc2.tar.gz) under C:\Test directory in my local computer.
Loop1: tFileList gets the absolute file path of abc.tar.gz.
tFileUnarchive unzip abc.tar.gz.
Use onComponentOK to trigger tOracleExec.
After finishing tOracleExec, use onComponnetOk to trigger tFileCopy. Copy abc.tar.gz from C:\Test to C:\Imported and remove source file(abc.tar.gz) in C:\Test.
Use tFileList_2 to iterate files under C:\Extraction. Then tFileDelete will delete one.csv.
Loop2 : Start to get abc2.tar.gz.
Regards,
Pedro
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi
1. What is the difference between Iterate and OnComponent OK?
2. Why does the job failed if i use Iterate in all the components?

I will explain it in a simple way.
The difference between Iterate and OnComponentOK is that OnComponentOK(OnSubjobOk) will declare a new method in Job code for one component while using Iterate it will in the same method with previous component.
When using Iterate, it may cause the wrong execution order of these components. Or sometimes some important values are not ready.
When using OnComponentOK, the method where the first component exists will call this new method. Make sure the right order and prepare all global values...
Regards,
Pedro
One Star tpk
One Star

Re: "File Not Found" exception for tFileUnarchive

Hi Pedro,
Thank You very much for the brief explanation. It makes sense for me and cleared my doubts.

Thanks and Regards,
Pavan