Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む

SFTP Connector | Unable to resolve the SFTP working directory with version 2.0.x or 2.2.2

公開日: Sep 13, 2024
解決策

SYMPTOM

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.
 

CAUSE

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.


SOLUTION

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

 
読み込み中
Salesforce Help | Article