使用Apache Camel连接到本地安装的FTP服务器(FileZilla)时,我遇到以下异常。
16:27:45.974 INFO [Camel (camel-1) thread #0 - ftp://x.x.x.x:21/in][org.apache.camel.component.file.remote.FtpConsumer] Connected and logged in to: ftp://kallada@x.x.x.x:21
16:27:45.980 WARN [Camel (camel-1) thread #0 - ftp://x.x.x.x:21/in][org.apache.camel.component.file.remote.RemoteFilePollingConsumerPollStrategy] Trying to recover by disconnecting from remote server forcing a re-connect at next poll: ftp://kallada@x.x.x.x:21
16:27:45.980 WARN [Camel (camel-1) thread #0 - ftp://x.x.x.x:21/in][org.apache.camel.component.file.remote.FtpConsumer] Error occurred while disconnecting from ftp://kallada@x.x.x.x:21 due: File operation failed: Software caused connection abort: socket write error. Code: 215. This exception will be ignored.
16:27:45.981 WARN [Camel (camel-1) thread #0 - ftp://x.x.x.x:21/in][org.apache.camel.component.file.remote.FtpConsumer] Consumer FtpConsumer[ftp://x.x.x.x:21/in?delay=5s&move=done&passiveMode=false&password=xxxxxx&username=kallada] failed polling endpoint: Endpoint[ftp://x.x.x.x:21/in?delay=5s&move=done&passiveMode=false&password=xxxxxx&username=kallada]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - File operation failed: Software caused connection abort: recv failed. Code: 215]
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: Software caused connection abort: recv failed. Code: 215
at org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:784)
at org.apache.camel.component.file.remote.FtpConsumer.doPollDirectory(FtpConsumer.java:88)
at org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:51)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:117)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.read(Unknown Source)
at org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:58)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:314)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:483)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:608)
at org.apache.commons.net.ftp.FTP.port(FTP.java:932)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:812)
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)e
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2930)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2977)
at org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:777)
... 12 moreows
FileZilla服务器控制台显示以下跟踪。
(000043)23-11-2014 16:27:45 - (not logged in) (x.x.x.x)> Connected on port 21, sending welcome message...
(000043)23-11-2014 16:27:45 - (not logged in) (x.x.x.x)> USER kallada
(000043)23-11-2014 16:27:45 - (not logged in) (x.x.x.x)> 331 Password required for kallada
(000043)23-11-2014 16:27:45 - (not logged in) (x.x.x.x)> PASS *******
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> 230 Logged on
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> TYPE A
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> 200 Type set to A
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> PWD
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> 257 "/" is current directory.
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> CWD in
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> 250 CWD successful. "/in" is current directory.
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> SYST
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> 215 UNIX emulated by FileZilla
(000043)23-11-2014 16:27:45 - kallada (x.x.x.x)> disconnected.
路线定义如下
ftp://x.x.x.x:21/in?username=kallada&password=xxxxxx&passiveMode=false&delay=5s&move=done
解决此问题的任何指针都会有所帮助。
答案 0 :(得分:2)
请检查防火墙是否设置为阻止FTP通信。