camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From watcher <patr...@daly.ws>
Subject Re: SFTP : Polling - Cannot list directory
Date Mon, 12 Jan 2009 14:55:55 GMT

I've updated the uri to the following 

The windows account pdaly is mapped to c:\myFolder

<endpoint id="printerSFTP"
uri="sftp://pdaly@127.0.0.1/printer?password=password&amp;binary=true&amp;expression=done/${file:name}&amp;recursive=true&amp;delay=10000&amp;initialDelay=2000&amp;readLock=rename&amp;knownHostsFile=c://known_host&amp;filter=#myAntFilter"/>

here's the log file from winsshd ( sftp server )

000000000777 2009-01-12 14:42:02.742506 UTC WinSSHD 5.04 [111] Info
  Session thread 1037 for Windows account 'MyCompany\pdaly' from
127.0.0.1:1356:
  Session channel 1: FlowSfsWin: Closed directory 'C:\myFolder\printer'.
Registered 1 successful
  operation. Listed 3 entries in 1 operation.

000000000778 2009-01-12 14:42:02.744018 UTC WinSSHD 5.04 [118] Info
  Session thread 1037 for Windows account 'MyCompany\pdaly' from
127.0.0.1:1356:
  Session channel 1: FlowSfsWin: Reading attributes for 'C:\myFolder\test1'
(follow symlink) failed
  with NoSuchFile. GetFileAttributes() failed: Windows error 2: The system
cannot find the file
  specified.

000000000779 2009-01-12 14:42:07.328740 UTC WinSSHD 5.04 [050] Info
  Session thread 1037 for Windows account 'MyCompany\pdaly' from
127.0.0.1:1356:
  Session channel 1: Closing session channel.

000000000780 2009-01-12 14:42:07.353080 UTC WinSSHD 5.04 [095] Info
  Session thread 1037 for Windows account 'MyCompany\pdaly' from
127.0.0.1:1356:
  Connection terminated by TCP/IP socket error:
  Component: winsshdManager/socketReader
  FlowSocketReader: Error receiving bytes.
  Windows error 10054: An existing connection was forcibly closed by the
remote host.


You can see that it has somehow polling from the root folder "c:\myFolder"
and ignores the uri path printer  "c:\myFolder\printer"

The correct path is
 'C:\myFolder\printer\test1' but it tries to read the path
'C:\myFolder\test1'



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Odd about the logger. It should use the classname as logname
> 
> I was wondering the problem is that you dont have any path in the URI
> so the list files cant handle (".")
> 
> Could you test by setting a subfolder for the FTP, just to see if we
> avoid the IndexOutOfBoundsException?
> 
> sftp://unixBox@127.0.0.1/myfolder?
> 
> 
> On Mon, Jan 12, 2009 at 1:22 PM, watcher <patrick@daly.ws> wrote:
>>
>> I've raised the issue in jira here
>> https://issues.apache.org/activemq/browse/CAMEL-1247
>>
>>  I having a problem turning on trace logging, I created a project using
>> the
>> maven camel-archetype-spring.
>>  I've update the log4j.properties to
>>
>> #
>> # The logging properties used for eclipse testing, We want to see debug
>> output on the console.
>> #
>> log4j.rootLogger=TRACE, out
>>
>> # uncomment the following line to turn on Camel debugging
>> #log4j.logger.org.apache.camel=DEBUG
>> #log4j.logger.com.jcraft.jsch=DEBUG
>> #log4j.logger.org.apache.camel.component.file=TRACE
>> log4j.logger.org.apache.camel.component=TRACE
>>
>> # uncomment the following line to turn on ActiveMQ debugging
>> #log4j.logger.org.apache.activemq=DEBUG
>>
>> #log4j.logger.org.springframework=DEBUG
>>
>>
>> # CONSOLE appender not used by default
>> log4j.appender.out=org.apache.log4j.ConsoleAppender
>> log4j.appender.out.layout=org.apache.log4j.PatternLayout
>> log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p
>> %m%n
>> #log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p
>> %-30.30c{1}
>> - %m%n
>>
>>
>> but I still dont get any TRace logs in my console
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Do you mind creating a ticket in JIRA and linking to this thread from,
>>> eg nabble?
>>>
>>> I will see what I can do. If you can then you are most welcome to dig
>>> into the camel-ftp codebase in 2.0 and see the bug.
>>> SftpRemoteFileOperations.java:258, is a good place to start
>>>
>>> BTW: Have you tried with TRACE logging? Camel will output a lot about
>>> dir paths etc that can help find what is wrong.
>>>
>>> You can try from log4j
>>> org.apache.camel.component=TRACE
>>>
>>>
>>>
>>> On Mon, Jan 12, 2009 at 12:59 PM, watcher <patrick@daly.ws> wrote:
>>>>
>>>> Hi
>>>>
>>>> I have set up an Openssh SFTP server as described here
>>>> http://www.xenocafe.com/tutorials/windows/openssh_sftp_server/index.php
>>>>
>>>> However, I'm getting a error when trying to poll the server.
>>>>
>>>> INFO: Connected and logged in to sftp://unixBox@127.0.0.1:22
>>>> 12-Jan-2009 11:44:10 org.apache.camel.impl.ScheduledPollConsumer run
>>>> WARNING: An exception occured while polling:
>>>> Endpoint[sftp://unixBox@127.0.0.1]: Cannot list directo
>>>> ry:
>>>> org.apache.camel.component.file.remote.RemoteFileOperationFailedException:
>>>> Cannot list directory:
>>>>        at
>>>> org.apache.camel.component.file.remote.SftpRemoteFileOperations.listFiles(SftpRemoteFileO
>>>> perations.java:264)
>>>>        at
>>>> org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:45)
>>>>        at
>>>> org.apache.camel.component.file.remote.RemoteFileConsumer.poll(RemoteFileConsumer.java:65
>>>> )
>>>>        at
>>>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:66)
>>>>        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(Scheduled
>>>> ThreadPoolExecutor.java:98)
>>>>        at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Schedule
>>>> dThreadPoolExecutor.java:181)
>>>>        at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadP
>>>> oolExecutor.java:205)
>>>>        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:1344)
>>>>        at
>>>> org.apache.camel.component.file.remote.SftpRemoteFileOperations.listFiles(SftpRemoteFileO
>>>> perations.java:258)
>>>>        ... 12 more
>>>> Caused by: java.lang.StringIndexOutOfBoundsException: String index out
>>>> of
>>>> range: 0
>>>>        at java.lang.String.charAt(String.java:687)
>>>>        at
>>>> com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2359)
>>>>        at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1176)
>>>>        ... 13 more
>>>> 12-Jan-2009 11:44:19 org.apache.camel.impl.ScheduledPollConsumer run
>>>>
>>>>
>>>> Here's some of my camel-context.xml file
>>>>
>>>>
>>>>         <camelContext
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>            <package>com.mycompany.router</package>
>>>>            <!-- use myFilter as filter to allow setting ANT paths for
>>>> which files
>>>> to scan for -->
>>>>            <endpoint id="printerSFTP"
>>>> uri="sftp://unixBox@127.0.0.1?password=password&amp;binary=true&amp;expression=done/${file:name}&amp;recursive=true&amp;delay=10000&amp;initialDelay=2000&amp;filter=#myAntFilter&amp;readLock=rename&amp;knownHostsFile=c://known_host"/>
>>>>            <endpoint id="fileRepository" uri="file://c://fileserver"/>
>>>>         </camelContext>
>>>>
>>>>        <!-- we use the AntPathMatcherRemoteFileFilter to use ant paths
>>>> for
>>>> includes and exlucde -->
>>>>        <bean id="myAntFilter"
>>>> class="org.apache.camel.component.file.remote.AntPathMatcherRemoteFileFilter">
>>>>
>>>>            <property name="includes" value="**/incoming/*"/>
>>>>            <property name="excludes" value="**/outgoing/*"/>
>>>>        </bean>
>>>>
>>>>
>>>> Things I've tried so far.
>>>> I believe I setup the correct premission on the folder
>>>> I running the SFTP locally with the firewall turned off.
>>>> I've tried another SFTP server ( Winsshd ) also
>>>> Upgraded jsch to 0.1.41
>>>>
>>>> Windows xp
>>>> apache camel-2.0-Snapshot
>>>>
>>>> Any ideas on why it can't list the directories?
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/SFTP-%3A-Polling---Cannot-list-directory-tp21413159s22882p21413159.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> /Claus Ibsen
>>> Apache Camel Committer
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/SFTP-%3A-Polling---Cannot-list-directory-tp21413159s22882p21413428.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> 
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/SFTP-%3A-Polling---Cannot-list-directory-tp21413159s22882p21415971.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message