B2B FTP Listener hangs after one try.

We have our B2B server in the DMZ acting as an ftp listener on port 21. The content handler grabs the incoming files and just sticks them into a directory.

You must be on NT B2B host? or your running as root on UNIX… Need to know which…

Is the ftp put completing? suggest running client in ftp debug and watch for friendly return codes…

Are the ftp sessions opening and closing? suggest monitoring the session log for proper close on initial session.

Finally, what do you mean by content handler grabs a file and puts in in a directory?? Do you mean that you have written you own custom content handler? otherwise, ftp is virtual and files will not persist after session is closed. That is unless you do an explict write to file in the flow that you are ftp’ing to…

Hope some of this helps… Hard to troubleshoot without more detial…

one last thing, are you sure that the OS ftp server is not hanging around causing conflicts?

We are running as root on Unix. Yes, the “put” is completing successfully; even stating that it transferred xxx bytes.

We are accepting multiple files from different vendors and don’t care about content. This is simply a “real-time” way to receive a file and place it in a directory that the user can have access to. We do have a custom java content handler that takes in
IDataCursor pipelineCursor = pipeline.getCursor();
incomingFile = (byte[]) pipelineCursor.getValue();
Then attaches the current date to a variable and writes the file:
fw = new FileWriter(newFile1);
fw.write(new String(incomingFile), 0, java.lang.reflect.Array.getLength(incomingFile));
fw.close();

I will do as you suggest and try the debug. I’ll post results… Thank you for your help.

I ran the client ftp in debug mode, and it shows nothing out of the ordinary. It shows bytes being transferred successfully. Then I went through and matched the begin and end session tags… no problem there. All sessions are ending properly.

The o/s ftp port has been changed to 7021, so that shouldn’t be interfering.

Restarting the wm server allows me to do one successful ftp. I know that the content handler is re-initiated with the server restart; so it’s got to be in there somewhere.

Please send me any other ideas… I’m out of them.
Thank you.

Here are a couple of thoughts from left field. Don’t know if they will address the trouble or not.

  • You mention that you don’t care about content. This implies that you might get binary data, though I may be reading more into the statement than necessary. FileWriter works with character data, converting encoding as needed. You may or may not want this. For max flexibility you may want to switch to FileOutputStream.

  • I’ve been bitten in the past by not doing a flush() call before a close.

  • Looking at the write() call, you’re passing in a string but specifying the length of the byte array. Judging from what you’re trying to do, you can just call write(new String(incomingFile)). No need to specify the offset and length if you’re writing the whole thing.

  • Come to think of it, I’m not sure why you’re converting the bytes to a String anyway. Just write the bytes. Try this:

IDataCursor pipelineCursor = pipeline.getCursor();
incomingBytes = (byte[]) pipelineCursor.getValue();
fos = new FileOutputStream(newFile1);
fos.write(incomingBytes);
fos.flush();
fos.close();

Hope one of these things helps.

Rob

Can’t help much if this is a content handler registration type problem. We have a custom handler and we register it on startup… sounds similar to you…

One thought came to mind. Are you always using the same file on the second transmission. If so, try doing the first one twice. We have had fits with special chars and the ftp listener. You know, the <, > , &,; ', " etc. I think there are 5 that must be escaped and if I recall, the ftp server will always do a parse to a values object but will hang if it encounters one of these if it is not escaped. Worst of all, there is no error thrown?? on 3.6 anyway…

Good luck…

I think the “flush” was what I am missing. Thanks for the help.

Also, I understand that with Integration Server 4.6, you no longer need a content handler? I have seen the sample code “writeToFile”, but am not sure how to implement this. How do you map the incoming content into that flow… that’s where I get lost. And, do you have to specify a package still when defining the port?

Thanks!!