Sunday, January 15, 2012

SOA 10g FTP Adapter Not Picking Files From FTP Server

This being my first post of 2012, I would like to wish all my readers a happy and prosperous new year. New year is time for resolutions :-) , apart from regular ones like "Will try to reduce weight" or "Try to keep my room clean" which never works out for me, I will definitely ensure that "I will share knowledge regularly".


New year, old issue. So decided to iron it out once and for all. SOA 10g FTP adapter wasn't picking files from remote FTP server after Jan 1st. Last file read was on Dec 31st. On further analysis found that the FTP adapter Control file had got corrupted.


The control file can be found under $OH/j2ee/home/fileftp/controlFiles/{processname~version}/xxxx/lastModifiedDate.txt


On checking the content of this file found below entry

#Sat Dec 31 23:21:55 CST 2011
lastModifiedTime=1356969420000

As you can see the lastModifiedTime shows as 1356969420000 (This is in milliseconds). This is Unix time or Epoch time and you can use the Epoch converter to convert it into corresponding timestamp.


After conversion it comes to:
GMT: Mon, 31 Dec 2012 15:57:00 GMT

This is where the problem lies. The lastModifiedTime has been set as 31st December 2012. As a result all files since Jan 1st 2012 are not being picked by FTP adapter because the adapter compares the timestamp on remote FTP server and only picks files which are greater than the lastModifiedTime.

What is epoch time?
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

SOLUTION

Stop the SOA server, take backup of controlFiles directory, remove the control files and redeploy the code , Start SOA server. As a result new control file should come into picture and FTP process should pick files correctly.

Why the controlFile (lastModifiedDate.txt) got corrupted at first place during year change...that is something which I have to figure out. Looks like a bug with Oracle FTP adapter. Will update this post once I get a confirmation regarding same.