当我尝试连接到 FTP 服务器并下载文件时,我收到 501 错误代码。我可以使用相同的用户使用 winscp 下载 csv 文件。我正在使用 Apache camel 2.17 版本。
在 Windows 命令提示符下:
C:\Users\benzyl>ftp 10.15.22.198
Connected to 10.15.22.198.
220-QTCP at SOURCESYSTEM.COMPANY.PARENTCOMPANY.
220 Connection will close if idle more than 5 minutes.
User (10.15.22.198:(none)): GAUNAME
331 Enter password.
Password:
230 GAUNAME logged on.
ftp> quote site namefmt 1
250 Now using naming format "1".
ftp> cd /home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP
250 "/home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP" is current directory.
ftp> get SOURCESYSTEM.CSV
200 PORT subcommand request successful.
150 Retrieving file /home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP/SOURCESYSTEM.CSV
226 File transfer completed successfully.
ftp: 150896 bytes received in 0,00Seconds 75448,00Kbytes/sec.
服务器日志:
12:37:51,838 WARN [org.apache.camel.component.file.remote.RemoteFilePollingConsumerPollStrategy] (Camel (SOURCESYSTEMContext) thread #0 - ftp://10.15.22.198:21/home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP) Trying to recover by disconnecting from remote server forcing a re-connect at next poll: ftp://GAUNAME@10.15.22.198:21
12:37:51,839 WARN [org.apache.camel.component.file.remote.FtpConsumer] (Camel (SOURCESYSTEMContext) thread #0 - ftp://10.15.22.198:21/home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP) Consumer FtpConsumer[ftp://10.15.22.198:21/home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP?delete=true&fileName=SOURCESYSTEM.CSV&password=xxxxxx&siteCommand=NAMEFMT+1&useList=false&username=GAUNAME] failed polling endpoint: Endpoint[ftp://10.15.22.198:21/home/COMPANY/SOURCESYSTEM/TEST/OUT/MOAPP?delete=true&fileName=SOURCESYSTEM.CSV&password=xxxxxx&siteCommand=NAMEFMT+1&useList=false&username=GAUNAME]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - File operation failed: 501 Unknown extension in database file name.
Cannot change directory to: home. Code: 501]: org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 501 Unknown extension in database file name.
Cannot change directory to: home. Code: 501
at org.apache.camel.component.file.remote.FtpOperations.doChangeDirectory(FtpOperations.java:778) [camel-ftp-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.component.file.remote.FtpOperations.changeCurrentDirectory(FtpOperations.java:756) [camel-ftp-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.component.file.remote.FtpConsumer.doPollDirectory(FtpConsumer.java:111) [camel-ftp-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:82) [camel-ftp-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:131) [camel-core-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) [camel-core-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) [camel-core-2.17.0.redhat-630262.jar:2.17.0.redhat-630262]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_151]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [rt.jar:1.8.0_151]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [rt.jar:1.8.0_151]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [rt.jar:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
你能告诉我如何解决这个问题吗