Following issue can occur when trying to connect to a ftp server through WSO2 ESB.
ERROR - FilePollingConsumer Error checking for existence and readability : ftp://wso2qa":***@"192.168.58.31/ESBJAVA-4493/in org.apache.commons.vfs2.FileSystemException: Could not determine the type of file "ftp://wso2qa:***@192.168.48.231/ESBJAVA-4493/in". at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:506) at org.apache.commons.vfs2.provider.AbstractFileObject.exists(AbstractFileObject.java:478) at org.wso2.carbon.inbound.endpoint.protocol.file.FilePollingConsumer.poll(FilePollingConsumer.java:172) at org.wso2.carbon.inbound.endpoint.protocol.file.FilePollingConsumer.execute(FilePollingConsumer.java:134) at org.wso2.carbon.inbound.endpoint.protocol.file.FileTask.taskExecute(FileTask.java:45) at org.wso2.carbon.inbound.endpoint.common.InboundTask.execute(InboundTask.java:44) at org.wso2.carbon.mediation.ntask.NTaskAdapter.execute(NTaskAdapter.java:90) at org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter.execute(TaskQuartzJobAdapter.java:67) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Host attempting data connection 203.94.95.230 is not same as server 192.168.xx.xx at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:912) at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:759) at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3293) at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3271) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2930) at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.listFilesInDirectory(FTPClientWrapper.java:186) at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.listFiles(FTPClientWrapper.java:176) at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetChildren(FtpFileObject.java:141) at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildFile(FtpFileObject.java:111) at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getInfo(FtpFileObject.java:200) at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:335) at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:497) ... 13 more
This error can occur when the server is trying to do a non passive connection to the FTP server.
Remedy
This issue can be avoided by making a passive connection to the ESB. You can modify the connection URL in the below format to achieve this.
ftp://wso2qa:wso2qa123@192.168.58.31/ESBJAVA-4493/in?vfs.passive=true