SFTP module upload error

1
I got error when I upload file via SFTP connector.(https://marketplace.mendix.com/link/component/107256) If you know workaround, please let me know. Procedure Configure the sftp connection via admin snipets. Test connection (success) Explorer Put  Browse and choose binary file Upload → error occures. After this and I checked it uploaded successfully An error occurred while uploading file: UnsupportedOperation: This operation is currently unsupported. Details: com.mendix.systemwideinterfaces.MendixRuntimeException: net.schmizz.sshj.sftp.SFTPException: UnsupportedOperation: This operation is currently unsupported. at SFTP.SFTP_Put (JavaAction : 'Put file') at {"name":"SFTP.Connect","type":"JavaAction"} at SFTP.IVK_Put (JavaAction : 'Upload file') Advanced stacktrace: at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: net.schmizz.sshj.sftp.SFTPException: UnsupportedOperation: This operation is currently unsupported. at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83) Caused by: net.schmizz.sshj.sftp.SFTPException: UnsupportedOperation: This operation is currently unsupported. at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83) Caused by: UnsupportedOperation: This operation is currently unsupported. at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83)  
asked
2 answers
0

Hi Masanori,

 

I have run into a similar issue before.  Make sure that you have the proper permissions on the FTP site to allow you to run put operations.  It is something that can typically be disallowed on a per user or per directory basis from the SFTP site admin and can cause a put operation to fail like this.

Hope this helps
Danny

answered
0

You may be encountering an issue with the Client FileTransfer property. It can be the case that the destination server does not allow the requesting server to preserve file attributes and passes back this type of error whilst having loaded the file. It is possible to resolve this by setting the attribute to false prior to the client Put call and then setting it back again after the call. 

 

You can try the following customisation of the PUT java action.

Once created call the customised java action from your microflow instead of the old one.

Create a new java action the same as the original (or copy the PUT one) in a customise module within your app named similarly to the current.

Add a new boolean parameter to this - DontPreserveAttributes defaulted to True or PreserveAttributes defaulted to false based on your preference of defining what you are doing.

Deploy for eclipse

Open your app in Eclipse and navigate to your new java action. 

Copy out the java code from the old PUT action and paste it into your new one.

Then add in your new parameter setup and finally call the method on the fileTransfer passing it a false if the setting you are sending tells it to. if not it doesn't call the method.

 

you can use the java code snips to guide you

add the variable

    private java.lang.Boolean DontPreserveAttributes;

set it up in the object

        this.DontPreserveAttributes = DontPreserveAttributes;

use it in the code before the put call

if (DontPreserveAttributes) client.getFileTransfer().setPreserveAttributes(false);

the put call

client.put(source, path);

use it after the put call to set it back

if (DontPreserveAttributes) client.getFileTransfer().setPreserveAttributes(true);

 

You could also use the .getPreserveAttributes() to test the value depending on your use case.

 

mendix snip of the java action

image.png

answered