You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Crivellaro <mc...@optasportsdata.com> on 2011/03/03 16:00:34 UTC
issue with sftp producer
Hi,
I am experiencing an issue with and sftp producer, I am not sure if this
should be considered a camel or a JCraft JSCH libray issue.
The exchange run in exception when it comes to list check if file exists on
destination org.apache.camel.component.file.remote.SftpOperations.existsFile
I've found out Camel calls
Vector files = channel.ls(directory); //line
passing directory as an empty String causing JSCH to run on
java.lang.StringIndexOutOfBoundsException
this is where the JSCH library runs in exception:
private String remoteAbsolutePath(String path) throws SftpException{
if(path.charAt(0)=='/') return path;
String cwd=getCwd();
// if(cwd.equals(getHome())) return path;
if(cwd.endsWith("/")) return cwd+path;
return cwd+"/"+path;
}
perhaps Camel should call the ls function passing "/" instead of and empty
string in case the path of the file could not be extracted?
--
View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408052.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: issue with sftp producer
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 7, 2011 at 2:42 PM, Marco Crivellaro
<mc...@optasportsdata.com> wrote:
> I've tested latest snapshot, everything works like a charm!
>
Thanks for testing and reporting back.
> Camel rocks!
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3412452.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: issue with sftp producer
Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I've tested latest snapshot, everything works like a charm!
Camel rocks!
--
View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3412452.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: issue with sftp producer
Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I've forgot to the JIRA ticket link:
https://issues.apache.org/jira/browse/CAMEL-3749
--
View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408268.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: issue with sftp producer
Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I can work on a patch, have two proposal as solution:
solution 1: in case directory information on filename cannot be retrieved
uses "/"
solution 2: in case directory information on filename cannot be retrieved
uses current directory (there should be a way to retrieve it)
I'd prefer the latter.
P.S.: Just bought Camel in Action book, it is very well done and usefull!
Thanks for that.
--
View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408266.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: issue with sftp producer
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Can you create a JIRA tracker.
You are welcome to work on a patch.
On Thu, Mar 3, 2011 at 5:19 PM, Marco Crivellaro
<mc...@optasportsdata.com> wrote:
> I am using Camel 2.7 SNAPSHOT with jsch 0.1.44
>
> the endpoint URI is as follow:
>
> sftp://user@hostname:22?disconnect=true&eagerDeleteTargetFile=false%3Bstepwise%3Dfalse&fileName=SYSTEM01&password=******&soTimeout=30000&tempFileName=%24%7Bfile%3Aname.noext%7D.8937937.tmp
>
>
> stack trace:
> [2011-03-03 14:40:40,827][RecipientList (thread
> #4)][ERROR][org.apache.camel.processor.DefaultErrorHandler][] Failed
> delivery for exchangeId: ID-******-33331-1299163043684-0-10. Exhausted after
> delivery attempt: 1 caught:
> org.apache.camel.component.file.GenericFileOperationFailedExcept on:
> org.apache.camel.component.file.GenericFileOperationFailedException:
> at
> org.apache.camel.component.file.remote.SftpOperations.existsFile(SftpOperations.java:727)
> at
> org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:130)
> at
> org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:50)
> at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> at
> org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:716)
> at
> org.apache.camel.processor.MulticastProcessor.access$100(MulticastProcessor.java:78)
> at
> org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:282)
> at
> org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:274)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 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:619)
> Caused by: 4:
> at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1353)
> at
> org.apache.camel.component.file.remote.SftpOperations.existsFile(SftpOperations.java:704)
> ... 20 more
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
> range: 0
> at java.lang.String.charAt(String.java:686)
> at
> com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2367)
> at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1185)
> ... 21 more
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408183.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: issue with sftp producer
Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I am using Camel 2.7 SNAPSHOT with jsch 0.1.44
the endpoint URI is as follow:
sftp://user@hostname:22?disconnect=true&eagerDeleteTargetFile=false%3Bstepwise%3Dfalse&fileName=SYSTEM01&password=******&soTimeout=30000&tempFileName=%24%7Bfile%3Aname.noext%7D.8937937.tmp
stack trace:
[2011-03-03 14:40:40,827][RecipientList (thread
#4)][ERROR][org.apache.camel.processor.DefaultErrorHandler][] Failed
delivery for exchangeId: ID-******-33331-1299163043684-0-10. Exhausted after
delivery attempt: 1 caught:
org.apache.camel.component.file.GenericFileOperationFailedExcept on:
org.apache.camel.component.file.GenericFileOperationFailedException:
at
org.apache.camel.component.file.remote.SftpOperations.existsFile(SftpOperations.java:727)
at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:130)
at
org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:50)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
at
org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:716)
at
org.apache.camel.processor.MulticastProcessor.access$100(MulticastProcessor.java:78)
at
org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:282)
at
org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:274)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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:619)
Caused by: 4:
at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1353)
at
org.apache.camel.component.file.remote.SftpOperations.existsFile(SftpOperations.java:704)
... 20 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
range: 0
at java.lang.String.charAt(String.java:686)
at
com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2367)
at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1185)
... 21 more
--
View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408183.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: issue with sftp producer
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What version of Camel and JSCH are you using?
And how have you configured the SFTP endpoint?
And can you paste the full stacktrace?
On Thu, Mar 3, 2011 at 4:00 PM, Marco Crivellaro
<mc...@optasportsdata.com> wrote:
> Hi,
> I am experiencing an issue with and sftp producer, I am not sure if this
> should be considered a camel or a JCraft JSCH libray issue.
>
> The exchange run in exception when it comes to list check if file exists on
> destination org.apache.camel.component.file.remote.SftpOperations.existsFile
>
> I've found out Camel calls
> Vector files = channel.ls(directory); //line
> passing directory as an empty String causing JSCH to run on
> java.lang.StringIndexOutOfBoundsException
>
> this is where the JSCH library runs in exception:
>
> private String remoteAbsolutePath(String path) throws SftpException{
> if(path.charAt(0)=='/') return path;
> String cwd=getCwd();
> // if(cwd.equals(getHome())) return path;
> if(cwd.endsWith("/")) return cwd+path;
> return cwd+"/"+path;
> }
>
>
>
> perhaps Camel should call the ls function passing "/" instead of and empty
> string in case the path of the file could not be extracted?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/issue-with-sftp-producer-tp3408052p3408052.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/