Dear all,
I am getting the following exception:
com.enterprisedt.net.ftp.FTPException: Possible PASV port theft, cannot open data connection.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:702)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:2273)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:2210)
at com.sisl.snms.saf.parser.ftpschdlr.FtpNotificationListener.handleNotification(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor$ListenerWrapper.handleNotification(DefaultMBeanServerInterceptor.java:1652)
at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221)
at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184)
at javax.management.timer.Timer.sendNotification(Timer.java:1295)
at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
I am also attaching the code:
FTPClient enterpriseFtp = null;
enterpriseFtp = new FTPClient();
enterpriseFtp.setRemoteHost(host);
FTPMessageCollector listener = new FTPMessageCollector();
enterpriseFtp.setMessageListener(listener);
// connect
enterpriseFtp.connect();
// login
enterpriseFtp.login(user, password);
enterpriseFtp.setType(FTPTransferType.ASCII);
// change to remote directory and print it to console
if((remote_dir != null) && !(remote_dir.trim().equalsIgnoreCase(""))){
enterpriseFtp.chdir(remote_dir);
}
//Now change to the system-specific(i.e. capri/samson) directory
enterpriseFtp.chdir(system);
remoteFiles = enterpriseFtp.dirDetails(enterpriseFtp.pwd());
enterpriseFtp.get(localDir + sep + system + sep +
remoteFiles[i].getName(),
remoteFiles[i].getName());
enterpriseFtp.quit();