Bug 882182

Summary: Camel FTP gateway unable to retrieve files
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Adam Kovari <akovari>
Component: JBossESBAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.3.0 GACC: nobody, soa-p-jira
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 882845    
Bug Blocks:    

Description Adam Kovari 2012-11-30 10:58:43 UTC
Description of problem:
There's a bug in the Camel 2.4.0 that's distributed with SOA 5.3.0. The SFTP module can't fetch files from an absolute directory.

The issue has been discussed in the Camel mailing-list, eg. http://mail-archives.apache.org/mod_mbox/camel-users/201010.mbox/%3C1DC819B9-BA60-49CA-9518-E18EE951729D@nerdylorrin.net%3E

And there classified as a bug. For us this shows up when we have a Camel fetch like this:

sftp://easiakas.20.235/data1/easiakas/heracles_finvoice/download/invoice/?password=xxxxxx&delay=5000&delete=true&include=[^T].*\.zip

(or //data1/easiakas/heracles_finvoice/download/invoice/, doesn't matter, and even non-absolute heracles_finvoice/download/invoice/ won't work):

17:45:51,688 INFO  [CamelRouteBuilder] Started message processing in camel input route. Filename: test.zip uuid: 74143f3e-68fe-4f04-a784-087af57c735c
18:02:14,701 ERROR [SftpConsumer] Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot retrieve file: data1/easiakas/heracles_finvoice/download/invoice/test.zip]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot retrieve file: data1/easiakas/heracles_finvoice/download/invoice/test.zip

So it finds the test.zip, but it can't download it, since it's in the wrong directory or tries to change directory to a wrong one.


Version-Release number of selected component (if applicable):
JBoss SOA 5.3.0
Apache Camel 2.4.0


How reproducible:
Always

Steps to Reproduce:
1. Modify camel-quickstart:
jboss-esb-unfiltered.xml

replace <from> to:
<from uri="sftp://akovari@localhost//home/adam/xxx/?password=xxx&amp;delay=5000&amp;delete=true&amp;include=.*"/>

2. run ant deploy

3. See the server log:

11:50:42,104 INFO  [EsbDeployment] Starting ESB Deployment 'Quickstart_camel_helloworld.esb'
11:50:42,150 INFO  [AnnotationTypeConverterLoader] Found 5 packages with 0 @Converter classes to load
11:50:42,150 INFO  [DefaultTypeConverter] Loaded 0 type converters in 0.036 seconds
11:50:42,240 INFO  [DefaultCamelContext] Apache Camel 2.4.0 (CamelContext: camel-6) is starting
11:50:42,240 INFO  [DefaultCamelContext] JMX is disabled. Using DefaultManagementStrategy.
11:50:42,249 INFO  [DefaultCamelContext] Route: route6 started and consuming from: Endpoint[sftp://akovari@localhost//home/adam/xxx/?delay=5000&delete=true&include=.*&password=gnomoZrut13]
11:50:42,249 INFO  [DefaultCamelContext] Started 1 routes
11:50:42,249 INFO  [DefaultCamelContext] Apache Camel 2.4.0 (CamelContext: camel-6) started in 0.009 seconds
11:50:43,249 INFO  [SftpOperations] JSCH -> Connecting to localhost port 22
11:50:43,249 INFO  [SftpOperations] JSCH -> Connection established
11:50:43,256 INFO  [SftpOperations] JSCH -> Remote version string: SSH-2.0-OpenSSH_5.9
11:50:43,256 INFO  [SftpOperations] JSCH -> Local version string: SSH-2.0-JSCH-0.1.38
11:50:43,256 INFO  [SftpOperations] JSCH -> CheckCiphers: aes256-cbc,aes192-cbc,aes128-cbc
11:50:43,256 INFO  [SftpOperations] JSCH -> aes256-cbc is not available.
11:50:43,256 INFO  [SftpOperations] JSCH -> aes192-cbc is not available.
11:50:43,257 INFO  [SftpOperations] JSCH -> SSH_MSG_KEXINIT sent
11:50:43,258 INFO  [SftpOperations] JSCH -> SSH_MSG_KEXINIT received
11:50:43,258 INFO  [SftpOperations] JSCH -> kex: server->client aes128-cbc hmac-md5 none
11:50:43,258 INFO  [SftpOperations] JSCH -> kex: client->server aes128-cbc hmac-md5 none
11:50:43,260 INFO  [SftpOperations] JSCH -> SSH_MSG_KEXDH_INIT sent
11:50:43,260 INFO  [SftpOperations] JSCH -> expecting SSH_MSG_KEXDH_REPLY
11:50:43,266 INFO  [SftpOperations] JSCH -> ssh_rsa_verify: signature true
11:50:43,266 WARN  [SftpOperations] JSCH -> Permanently added 'localhost' (RSA) to the list of known hosts.
11:50:43,267 INFO  [SftpOperations] JSCH -> SSH_MSG_NEWKEYS sent
11:50:43,267 INFO  [SftpOperations] JSCH -> SSH_MSG_NEWKEYS received
11:50:43,267 INFO  [SftpOperations] JSCH -> SSH_MSG_SERVICE_REQUEST sent
11:50:43,267 INFO  [SftpOperations] JSCH -> SSH_MSG_SERVICE_ACCEPT received
11:50:43,269 INFO  [SftpOperations] JSCH -> Authentications that can continue: gssapi-with-mic,publickey,keyboard-interactive,password
11:50:43,269 INFO  [SftpOperations] JSCH -> Next authentication method: gssapi-with-mic
11:50:43,272 INFO  [SftpOperations] JSCH -> Authentications that can continue: publickey,keyboard-interactive,password
11:50:43,272 INFO  [SftpOperations] JSCH -> Next authentication method: publickey
11:50:43,273 INFO  [SftpOperations] JSCH -> Authentications that can continue: password
11:50:43,273 INFO  [SftpOperations] JSCH -> Next authentication method: password
11:50:43,290 INFO  [SftpOperations] JSCH -> Authentication succeeded (password).
11:50:43,442 INFO  [SftpOperations] Connected to sftp://akovari@localhost:22
11:50:43,442 INFO  [SftpConsumer] Connected and logged in to: sftp://akovari@localhost:22

11:51:08,271 ERROR [SftpConsumer] Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot retrieve file: home/adam/xxx/xx1]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot retrieve file: home/adam/xxx/xx1
	at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:393)
	at org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:377)
	at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:290)
	at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:144)
	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:110)
	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:98)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: 2: No such file
	at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2291)
	at com.jcraft.jsch.ChannelSftp._get(ChannelSftp.java:889)
	at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:858)
	at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:837)
	at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:390)
	... 14 more
  
Actual results:
Files cannot be downloaded.

Expected results:
Files to be downloaded properly.

Additional info: