I am currently working on the Mule 4.4 On-Prem application which runs on Unix container based. the app is trying to create new folder and creates new file on the folder. I am using smb connector 3.1.1 and it works well with few requests and keeps getting connection reset by peer error after 5 or 10 minutes (once the first error occurs it never reconnects).
Code looks like below:-
<smb:config name="SMB_Connector_Config" doc:name="SMB Connector Config" doc:id="4cb53c1c-edbe-4068-8694-6ed860730b1d" >
<smb:connection host="xx.xx.xxx.xx" share="TCS" username="mule" password="****" fileAgeUnit="MINUTES" fileAge="60" socketTimeout="10" socketTimeoutUnit="MINUTES" domain="******.NET"/>
</smb:config>
<flow name="test-smbFlow" doc:id="657bcb88-1dea-4e67-8390-9567fdfc5c5b" >
<http:listener doc:name="Listener" doc:id="8db8d8e0-9cfb-4d5b-afcf-4bcce6d67fc5" config-ref="HTTP_Listener_config" path="test2"/>
<ee:transform doc:name="Transform Message" doc:id="a1e88ffe-3d64-4093-97ac-c1bb81040790" >
<ee:message >
</ee:message>
<ee:variables >
<ee:set-variable variableName="cachedResponse" ><![CDATA[%dw 2.0
output application/json
---
{
'message' : "xyz"
}]]></ee:set-variable>
<ee:set-variable variableName="fileName" ><![CDATA[output application/java
---
"$(correlationId).json"]]></ee:set-variable>
<ee:set-variable variableName="folderName" ><![CDATA[%dw 2.0
output application/java
---
correlationId]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="test-smbSub_Flow" doc:id="8908444f-6d76-4df6-beff-f03e604e69ea" name="test-smbSub_Flow"/>
<logger level="INFO" doc:name="Logger" doc:id="00c0343c-21cc-4af1-8427-2542f0415f0a" />
</flow>
<flow name="test-smbSub_Flow" doc:id="bfe3935a-e4ed-44be-b4c5-f148821c395c" >
<smb:directory-create doc:name="Directory Create" doc:id="cf111d1a-41f3-4e48-8461-e5f6b1f47849" config-ref="SMB_Connector_Config" dirName="#['\Input\Folder' ++ '\\' ++ vars.folderName]">
<reconnect-forever />
</smb:directory-create>
<smb:file-write doc:name="File Write" doc:id="9d654a52-6006-4aae-a21c-de731799ea51" config-ref="SMB_Connector_Config" fileName="#[vars.fileName]" dirName="#['\Input\Folder' ++ '\\' ++ correlationId]">
<reconnect-forever frequency="6000" blocking="false" />
<smb:file-content><![CDATA[#[vars.cachedResponse]]]></smb:file-content>
</smb:file-write>
</flow>
Error I am getting is like :-
Message : com.hierynomus.protocol.transport.TransportException: java.net.SocketException: Connection reset by peer: socket write error
Element : test-smbSub_Flow/processors/0 @ test-smb:test-smb.xml:45 (Directory Create)
I tried all possibility of old version of connector, with different mule runtimes etc. Nothing seems to be working. I could not able to get much help from the Share server team as well. As this app is part of mule3 to mule4 application migration there share believe to be working. I referred all thsoe available mule4 support document related to smb connector nothing helps. If anyone could suggests any workaround this issue or alternative to smb connector really helps. if any reference to existing java solution also helps. Thanks in advance
First of all,
SMB connector is not reliable connector. Alternative you should use JAVA library like smbj which is SMB client Implementation.
Now coming to your issues: Try below