You have a Mule Application that uses an SFTP Connector to interact with a server. Upon testing you see any of the following behaviors:
Option A:
******************************************************************************** Message : Unable to resolve the working directory from server timed out. Please configure a valid working directory or use absolute paths on your operation. Element : testflow/processors/2 @ testapp:api.xml:20 (List) Element DSL : <sftp:list doc:name="List" config-ref="SFTP_Config" directoryPath="yourDirectory"> </sftp:list> Error type : SFTP:ILLEGAL_PATH FlowStack : at testflow(list-flow/processors/2 @ testapp:api.xml:20 (List)) at processors/0 @ testapp:api.xml:100 (testflow)) Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.NullPointerException at org.mule.extension.sftp.internal.connection.SftpClient.lambda$executePWDCommandWithTimeout$1(SftpClient.java:414) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:151) at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) ********************************************************************************
Option B:
While enabling the SFTP Connector debug logs you see traces pointing towards a "pwd" command execution with no response from the server:
[2023-11-01 18:22:46.156] DEBUG org.apache.sshd.client.channel.ChannelExec [sshd-SshClient[15f215e3]-nio2-thread-1]: doOpen(ChannelExec[id=1, recipient=1]-ClientSessionImpl[Mulesoft@testserver.com/someIP]) send SSH_MSG_CHANNEL_REQUEST exec command=pwd [2023-11-01 18:22:46.157] DEBUG org.apache.sshd.client.session.ClientSessionImpl [sshd-SshClient[15f215e3]-nio2-thread-1]: encode(ClientSessionImpl[Mulesoft@testserver.com/someIP]) packet #10 sending command=98[SSH_MSG_CHANNEL_REQUEST] len=21 [2023-11-01 18:22:46.157] DEBUG org.apache.sshd.common.io.nio2.Nio2Session [sshd-SshClient[15f215e3]-nio2-thread-1]: writeBuffer(Nio2Session[local=/localserver:port, remote=testserver.com/someIP:port]) writing 80 bytes
After these traces, no further processing occurs.
In some cases, the SFTP servers do not return the output of the present working directory command with the Apache Mina library, causing the operation in question to fail. The issue was observed right after the SFTP connector version was upgraded from an old version to 2.2.2.
Explicitly set the working directory in the SFTP Configuration to avoid the "pwd" command request using the attribute "workingDir".
Example of this config:
<sftp:config name="SFTP_Config" doc:name="SFTP Config"> <sftp:connection host="yourHost" username="yourUser" password="yourPass" workingDir="/"> <reconnection > <reconnect frequency="10000" /> </reconnection> </sftp:connection> </sftp:config>
001117389

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.