Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Problem with tFTPPut to a server that immediately moves file

We have a talend job that generates some data into a CSV file and then sftp's the CSV file to another server not hosted by us.
When we test the job locally using our sftp servers, it works fine.  However, there is some peculiarity with the non-hosted server that is run by one of our partners that immediately moves the file the second it is uploaded.  Meaning, if you put the file and then type "ls", the file does not show in the directory listing.
Our talend job runs fine locally with our "normal" sftp server, but with this other SFTP server, the job throws a "2: File not found" exception (relevant portion below). 
We have determined that this error is caused by JSCH calling "stat" after upload to make sure the file is there.  Is there any way that we can prevent this from causing an error?  We can design our job to keep going despite this error, but the most obvious ways "On Component Error" seem like it will prohibit learning about actual errors (i.e. if the sftp server was down) since it would ignore all errors. 
How do we ignore just this one specific error?

Exception in component tFTPPut_2
2: File not found
        at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
        at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2198)
        at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215)
        at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:2172)
Labels (4)
3 Replies
Anonymous
Not applicable

I guess there is no quick solution.
You can lead the OnComponentError to a tJava and check here the error message in this way:
String errorMessage = (String) globalMap.get("tFTPPut_1_ERROR_MESSAGE");
if (errorMessage.contains("File not found") == false) {
   throw new Exception("Transfer failed: " + (String) globalMap.get("tFTPPut_1_ERROR_MESSAGE"));
}
_AnonymousUser
Specialist III
Specialist III
Author

Is there a way to override the tFTPPut component to not "stat" the file after it uploads?  Stat() is a routine in JSch that is causing the exception to be thrown.  It verifies that the file is in the location that it was uploaded to.  Of course, in our scenario, if the file is moved instantly upon upload, that routine will fail which is why the job fails.  So I'm wondering if there's a way to either override the component or use a tJava to upload the file.
Anonymous
Not applicable

Of course you can extract the Java code and build your own version using a tJava or better tJavaFlex. For sure you would be able to fix the bahaviour. I have not worked so far with the JSch API but it sounds possible to do that.