2015-10-02 68 views
0

我們想用apache駱駝訪問eBay商家集成平臺(mip)。 它的「sftp服務器像」協議服務於你將工作的目錄結構。用Apache Camel訪問Ebay商業集成平臺(MIP)

所以這是一個用Apache Camel處理目錄的主要例子。

但是我們遇到了錯誤,因爲mip-interface不顯示(或者不具有)技術「。」和「..」目錄。

任何人都可以給我一個提示

  • 如何配置Apache的駱駝,它可以處理沒有目錄結構「」和「..」?或者
  • 有沒有更好的方法來訪問eBay與java工具,支持海量數據操作?

在此先感謝。

09:13:15.909 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO o.a.c.c.file.remote.SftpOperations - JSCH -> Authentications that can continue: password 
09:13:15.910 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO o.a.c.c.file.remote.SftpOperations - JSCH -> Next authentication method: password 
09:13:16.174 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO o.a.c.c.file.remote.SftpOperations - JSCH -> Authentication succeeded (password). 
09:13:16.753 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO o.a.c.c.file.remote.SftpOperations - Connected to sftp://[email protected]:22 
09:13:16.753 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Connected and logged in to: sftp://[email protected]:22 
09:13:19.070 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Error occurred during poll directory: store/product/output/Oct-02-2015 due Cannot list directory: .. Removing 0 files marked as in-progress. 
09:13:19.080 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] WARN o.a.c.c.file.remote.SftpConsumer - Consumer Consumer[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser] failed polling endpoint: Endpoint[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory: .] 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: . 
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:583) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:560) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:88) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15.2.jar:2.15.2] 
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2] 
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45] 
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_45] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_45] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_45] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45] 
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45] 
Caused by: com.jcraft.jsch.SftpException: /store/product/output/Oct-02-2015/. is not a valid file path 
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2198) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1565) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526) ~[jsch-0.1.51.jar:na] 
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:574) ~[camel-ftp-2.15.2.jar:2.15.2] 
    ... 13 common frames omitted 
09:13:34.221 [pool-2-thread-1] DEBUG o.h.e.j.c.i.DriverManagerConnectionProviderImpl - Connection pool now considered primed; min-size will be maintained 
09:13:34.307 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Error occurred during poll directory: store/product/output/Oct-02-2015 due Cannot change directory to: store. Removing 0 files marked as in-progress. 
09:13:34.308 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] WARN o.a.c.c.file.remote.SftpConsumer - Consumer Consumer[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser] failed polling endpoint: Endpoint[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot change directory to: store] 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot change directory to: store 
    at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:542) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpOperations.changeCurrentDirectory(SftpOperations.java:530) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:80) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.15.2.jar:2.15.2] 
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15.2.jar:2.15.2] 
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2] 
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45] 
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_45] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_45] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_45] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45] 
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45] 
Caused by: com.jcraft.jsch.SftpException: 
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp._realpath(ChannelSftp.java:2340) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:342) ~[jsch-0.1.51.jar:na] 
    at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:540) ~[camel-ftp-2.15.2.jar:2.15.2] 
    ... 13 common frames omitted 

回答

0

OMG - 簡單的解決方案是發現:

設置逐步=假將解決這個問題。

爲什麼?在看看到SftpConsumer.doPollDirectory()後,我找到了一個不錯的IF-THEN-ELSE塊:

if (isStepwise()) { 
     files = operations.listFiles(); 
    } else { 
     files = operations.listFiles(dir); 
    } 

如果逐步被設置爲false,那麼消費者將逐步深入每個目錄的水平。在這種情況下,它會嘗試使用「ls -al」加載文件夾中的文件和目錄。命令。