wso2sftpwso2-esbvfs

wso2 VFS Transport Sender Error while writing to windows sftp path


I'm stuck up on more errors in the same code mentioned in the question linked here.

I get this error as given below:-

(Error - 1)

ERROR {VFSUtils} - Couldn't verify the lock java.io.IOException: inputstream is closed
        at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2911)
        at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935)
        at com.jcraft.jsch.ChannelSftp.access$500(ChannelSftp.java:36)
        at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:1417)
        at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:290)
        at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
        at org.apache.commons.vfs2.util.MonitorInputStream.read(MonitorInputStream.java:91)
        at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
        at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
        at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
        at org.apache.commons.vfs2.util.MonitorInputStream.read(MonitorInputStream.java:91)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at org.apache.synapse.commons.vfs.VFSUtils.verifyLock(VFSUtils.java:356)
        at org.apache.synapse.commons.vfs.VFSUtils.acquireLock(VFSUtils.java:231)
        at org.apache.synapse.commons.vfs.VFSUtils.acquireLock(VFSUtils.java:175)
        at org.apache.synapse.transport.vfs.VFSTransportSender.acquireLockForSending(VFSTransportSender.java:396)
        at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:279)
        at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:678)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:86)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:586)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:409)
        at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:77)
        at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
        at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:213)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:249)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:820)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:322)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:608)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:207)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
 WARN {VFSTransportSender} - Couldn't get the lock for the file : sftp://{sftp_path}/abc.json, retry : 1 scheduled after : 30000

(Error - 2)

ERROR {VFSUtils} - Cannot get the lock for the file : sftp://{sftp_path}/abc.json before processing org.apache.commons.vfs2.FileSystemException: Could not write to "sftp://{sftp_path}/xyz.json.lock".
        at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1197)
        at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:413)
        at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:392)
        at org.apache.synapse.commons.vfs.VFSUtils.createLockFile(VFSUtils.java:262)
        at org.apache.synapse.commons.vfs.VFSUtils.acquireLock(VFSUtils.java:220)
        at org.apache.synapse.commons.vfs.VFSUtils.acquireLock(VFSUtils.java:175)
        at org.apache.synapse.transport.vfs.VFSTransportSender.acquireLockForSending(VFSTransportSender.java:396)
        at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:279)
        at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:678)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:86)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:586)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:409)
        at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:77)
        at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
        at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:213)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:249)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:820)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:322)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:608)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:207)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: 4:
        at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:882)
        at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:709)
        at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:703)
        at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetOutputStream(SftpFileObject.java:519)
        at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1193)
        ... 35 more
Caused by: java.io.IOException: Pipe closed
        at java.base/java.io.PipedInputStream.read(PipedInputStream.java:307)
        at java.base/java.io.PipedInputStream.read(PipedInputStream.java:377)
        at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2909)
        at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935)
        at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:757)
        ... 39 more
    
    

(Error - 3)

 ERROR {VFSUtils} - Couldn't release the lock for the file : sftp://{sftp_path}/def.json after processing
   ERROR {VFSTransportSender} - IO Error while creating response file : sftp://{sftp_path}/def.json org.apache.commons.vfs2.FileSystemException: Could not write to "sftp://{sftp_path}/def.json".
            at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1197)
            at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:413)
            at org.apache.synapse.transport.vfs.VFSTransportSender.populateResponseFile(VFSTransportSender.java:352)
            at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:280)
            at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
            at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
            at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
            at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
            at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
            at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:678)
            at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:86)
            at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:586)
            at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:409)
            at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:77)
            at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
            at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
            at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
            at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
            at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
            at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
            at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:213)
            at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:249)
            at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:820)
            at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:322)
            at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:608)
            at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:207)
            at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
            at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298)
            at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: 4:
            at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:882)
            at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:709)
            at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:703)
            at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetOutputStream(SftpFileObject.java:519)
            at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1193)
            ... 31 more
    Caused by: java.io.IOException: Pipe closed
            at java.base/java.io.PipedInputStream.read(PipedInputStream.java:307)
            at java.base/java.io.PipedInputStream.read(PipedInputStream.java:377)
            at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2909)
            at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935)
            at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:757)
            ... 35 more

I'm reading from and writing to multiple files in a windows sftp. Can this be an issue with my sftp server ? or can i make changes to the wso2 config files or add some property to the proxy that could fix this issue?


Solution

  • Looks to me like there's a permission issue on the ftp. I would first check those and if they are correct try with disabling the lock mechanism.

    Not sure if it works if you set transport.vfs.Locking=false in the sftp url, another way could be set it to <property name="transport.vfs.Locking" scope="transport" value="false"> before you write to the ftp.

    https://ei.docs.wso2.com/en/latest/micro-integrator/references/synapse-properties/transport-parameters/vfs-transport-parameters/

    Hope that helps.