WSO2 ESB: SFTP file transfer: Could not connect to SFTP server - wso2

I am trying to transfer some files from local server to SFTP server using WSO2 Enterprise Integrator 6.3.0. I have username, SFTP location, SFTP port(990), ppk file and PassPhrase. When I tried below configuration in my Proxy service, I couldn't connect to SFTP server. It gives com.jcraft.jsch.JSchException: Auth fail error. With putty, connection works.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="SFTPFileTransferProxy" startOnLoad="true"
trace="disable" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property expression="$trp:FILE_NAME" name="FILE_NAME"
scope="default" type="STRING"/>
<log level="custom">
<property expression="$ctx:FILE_NAME" name="FL2"/>
<property name="sequence" value="FTPProxy"/>
</log>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.PollInterval">10000ms</parameter>
<parameter name="transport.vfs.FileURI">file:///C:/files/out</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///C:/test/failure</parameter>
<parameter name="transport.vfs.SFTPIdentities">file:///C:/sftp/keys/PrivateKey_Integration.ppk</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*\.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://username#sftp.XXXX.com:990/in/file/</parameter>
<parameter name="transport.vfs.SFTPIdentityPassPhrase">KEY_PASSPHRASE</parameter>
</proxy>
And the error I am getting is
[2019-02-04 12:48:31,823] [] ERROR - VFSTransportListener File object 'file:///C:/files/out/20181226FULL.csv'cloud not be moved, will remain in "locked" state
org.apache.axis2.AxisFault: Error resolving directory to move after processing : sftp://username#sftp.XXXX.com:990/in/file
at org.apache.axis2.transport.base.AbstractTransportListener.handleException(AbstractTransportListener.java:343)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:715)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:504)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp://username#sftp.XXXX.com:990/".
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:86)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:149)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:111)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:778)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:658)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:667)
... 8 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp.XXXX.com".
at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:164)
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:79)
... 14 more
Caused by: com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at com.jcraft.jsch.Session.connect(Session.java:183)
at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:162)
... 15 more
How to connect SFTP server with SFTPIdentities?

Try Key path as below, on Windows. It works for me.
<parameter name="transport.vfs.SFTPIdentities">/sftp/keys/PrivateKey_Integration.ppk</parameter>
On Ubuntu, I am giving the key path as
<parameter name="transport.vfs.SFTPIdentities">/home/sbhatti/.ssh/key.ppk</parameter>
But it is not working, and giving the same exception as posted in question above. anyone has any idea? How we can debug and apply correct path?

Related

ERROR: {EmailSend} - {api:EmailMicroService} Error occurred while sending the email

Scenario
I'm sending email via an unsecure smtp server connection with the help of Email connector of wso2.
Connection
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="unSecureConn" xmlns="http://ws.apache.org/ns/synapse">
<email.init>
<requireAuthentication>true</requireAuthentication>
<connectionType>SMTP</connectionType>
<password>XXXXX</password>
<host>smtp.XXXX.com</host>
<port>25</port>
<name>unSecureConn</name>
<username>XXXXXX</username>
</email.init>
</localEntry>
API:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/email" name="EmailMicroService" port="8290" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/send">
<inSequence>
<log level="full"/>
<email.send configKey="unSecureConn">
<from>{json-eval($.from)}</from>
<to>{json-eval($.to)}</to>
<subject>{json-eval($.subject)}</subject>
<content>{json-eval($.content)}</content>
<contentType>{json-eval($.contentType)}</contentType>
<attachments>{json-eval($.attachments)}</attachments>
</email.send>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Question
I'm facing the relay access denied issue. Although our smtp server is sending emails when logged in to server's user portal. However with the wso2 connector we are facing the following issue:
[2022-11-16 13:55:17,526] ERROR {EmailSend} - {api:EmailMicroService} Error occurred while sending the email with subject hi to ayub.jamal#XXXX.com. org.wso2.carbon.connector.exception.EmailConnectionException: Error occurred while sending the email with subject hi to ayub.jamal#XXXX.com.
at org.wso2.carbon.connector.operations.EmailSend.sendMessage(EmailSend.java:116)
at org.wso2.carbon.connector.operations.EmailSend.connect(EmailSend.java:59)
at org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
at org.apache.synapse.mediators.ext.ClassMediator.updateInstancePropertiesAndMediate(ClassMediator.java:178)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:136)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:170)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:93)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.api.Resource.process(Resource.java:342)
at org.apache.synapse.api.API.process(API.java:477)
at org.apache.synapse.api.AbstractApiHandler.apiProcess(AbstractApiHandler.java:93)
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:71)
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:376)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:435)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
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: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 <ayub.jamal#XXXX.com>: Relay access denied
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:2079)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1301)
at javax.mail.Transport.send0(Transport.java:255)
at javax.mail.Transport.send(Transport.java:124)
at org.wso2.carbon.connector.operations.EmailSend.sendMessage(EmailSend.java:135)
at org.wso2.carbon.connector.operations.EmailSend.sendMessage(EmailSend.java:110)
... 29 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 <ayub.jamal#XXXX.com>: Relay access denied
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1979)
... 34 more
Try adding the following parameter to the init.
<requireTLS>false</requireTLS>
Here are all the parameters you can set for the init operation. So depending on your SMTP server, you may have to set the appropriate parameters.
<parameter name="host" description="Host name of the mail server"/>
<parameter name="port" description="The port number of the mail server"/>
<parameter name="name" description="Unique name the connection is identified by"/>
<parameter name="username" description="Username used to connect with the mail server"/>
<parameter name="password" description="Password to connect with the mail server"/>
<parameter name="connectionType" description="Email connection type (protocol) that should be used to establish the connection with the server"/>
<parameter name="readTimeout" description="The socket read timeout value"/>
<parameter name="connectionTimeout" description="The socket connection timeout value"/>
<parameter name="writeTimeout" description="The socket write timeout value"/>
<parameter name="requireTLS" description="Whether the connection should be established using TLS"/>
<parameter name="checkServerIdentity" description="Whether server identity should be checked"/>
<parameter name="trustedHosts" description="Comma separated string of trust host names"/>
<parameter name="sslProtocols" description="Comma separated string of SSL protocol"/>
<parameter name="cipherSuites" description="Comma separated string of Cipher Suites"/>
<parameter name="maxActiveConnections" description="Maximum number of active connections in the pool"/>
<parameter name="maxIdleConnections" description="Maximum number of idle connections in the pool"/>
<parameter name="maxWaitTime" description="Maximum time to wait for a pooled component to become available"/>
<parameter name="minEvictionTime" description="The minimum amount of time an object may sit idle in the pool before it is eligible for eviction"/>
<parameter name="evictionCheckInterval" description="The number of milliseconds between runs of the object evictor"/>
<parameter name="exhaustedAction" description="The behavior of the pool when the pool is exhausted."/>
<parameter name="requireAuthentication" description="Whether authentication is required for SMTP server."/>

WSO2 Enterprise Integrator v6.1.1 make lock file while moving a file using VFS

I am using WSO2 Enterprise Integrator 6.1.1 . I am using VFS to poll a file from one directory and move to another directory. But my proxy service is making a lock file, and unable to move the file. I initially thought that it is a file permission issue but when I try it with Inbound Endpoint or my custom java mediator called in a proxy service. Then file is successfully moved.
Lock File:
Proxy Service Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestCSVFileMoving"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="vfs">
<target>
<inSequence>
<log level="full"
separator=",========----------Test CSV File Proxy Triggered------======="/>
</inSequence>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">30</parameter>
<parameter name="transport.vfs.FileURI">vfs:file:///files/uploads</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:file:///opt/file/con/Fail</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">Test.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:file:///opt/file/con/Out</parameter>
<description/>
</proxy>
Error Logs:
TID: [-1234] [] [2018-01-10 12:51:56,634] ERROR {org.apache.synapse.transport.vfs.VFSTransportListener} - File object 'file:///files/uploads/Test.csv'cloud not be moved, will remain in "locked" state {org.apache.synapse.transport.vfs.VFSTransportListener}
org.apache.axis2.AxisFault: Error moving file : file:///files/uploads/Test.csv to file:///opt/file/con/Out
at org.apache.axis2.transport.base.AbstractTransportListener.handleException(AbstractTransportListener.java:343)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:682)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:499)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename "file:///files/uploads/Test.csv" because it is read-only.
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1087)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:680)
... 8 more
Problem Statement:
My Question is that in the error log, it clearly states that it is a read only file. But Why that by using Inbound Endpoint and Calling a custom mediator I am able to move the file.But using VFS only I am getting this error? Also is there any way to solve it. If I have to use the VFS.

Scheduled Message Forwarding Processor does not deactivate after X delivery attempts

I'm running WSO2 ESB 4.5.1 with Sun Java SE 1.6.0_33 on Red Hat 2.6.32 using Apache ActiveMQ 5.5.1 as persistent storage to the ESB.
I’m trying to write a flow that:
1. reads address information from XML file
2. save each address in MQ queue
3. have a Message Processor read from MQ and attempt delivery to a JMS Endpoint
4. if the delivery fails the Message Processor is to attempt one more delivery before deactivating itself
When the JMS Endpoint (another ActiveMQ instance running on another server) is up everything works great, but if I stop the ActiveMQ that is acting as the JMS Endpoint the Message Processor does not deactivate as I expect after one retry but continually attempts to resend the same messages from Message Store. What is going wrong?
Here is the flow I have:
Proxy:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="AddressPxy" transports="vfs" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<property name="target.endpoint" value="AddressesEP" scope="default" type="STRING"/>
<log level="full"/>
<iterate expression="//addresses/address">
<target>
<sequence>
<store messageStore="AddressesMS"/>
</sequence>
</target>
</iterate>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///home/esb/sent</parameter>
<parameter name="transport.vfs.FileURI">file:///home/esb/addresses.xml</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///home/esb/fail</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description></description>
</proxy>
Message Store:
<messageStore name="AddressesMS" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
Message Processor:
<messageProcessor name="AddressesMP" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="AddressesMS" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">10000</parameter>
<parameter name="max.delivery.attempts">1</parameter>
</messageProcessor>
Endpoint:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="AddressesEP">
<address uri="jms:/Addresses?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://rhdev001:61616&transport.jms.DestinationType=queue">
</address>
</endpoint>
I see this error message in wso2carbon.log:
TID: [0] [ESB] [2012-11-07 02:58:07,396] ERROR {org.apache.axis2.transport.jms.JMSSender} - Unable to create a JMSMessageSender for : null {org.apache.axis2.transport.jms.JMSSender}
javax.jms.JMSException: Could not connect to broker URL: tcp://rhdev001:61616. Reason: java.net.ConnectException: Connection refused
TID: [0] [ESB] [2012-11-07 02:58:07,398] ERROR {org.apache.synapse.message.processors.forward.BlockingMessageSender} - Error sending Message to url : jms:/Addresses?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://rhdev001:61616&transport.jms.DestinationType=queue {org.apache.synapse.message.processors.forward.BlockingMessageSender}
org.apache.axis2.AxisFault: Unable to create a JMSMessageSender for : null
TID: [0] [ESB] [2012-11-07 02:58:07,399] ERROR {org.apache.synapse.message.processors.forward.ForwardingJob} - Error Forwarding Message {org.apache.synapse.message.processors.forward.ForwardingJob}
java.lang.Exception: Error while Sending Message
Hope someone can help me!
In this version of ESB There is a slight problem with "max.delivery.attempts" parameter in the message processor. But you can make this work by going to source view and changing "max.delivery.attempts" to "max.deliver.attempts".

WSO2 ESB: WARNING: EPRs are NULL. Transport configuration my be incorrect

When activating a proxy (with the Web UI), I always get following error message:
WARNING: EPRs are NULL. Transport configuration may be incorrect
But I just don't understand why and what it means?
The source of the proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="patient_toMPI_pJMS_qPatientToMPI" statistics="disable" trace="disable" transports="jms">
<parameter name="transport.jms.Destination">patient_qPatientToMPI</parameter>
<parameter name="transport.jms.ConnectionFactory">queueNonBlocking</parameter>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<target faultSequence="errorSequence">
<inSequence>
<log level="custom">
<property name="Patient/toMPI" value="proxy (patient_toMPI_pJMS_qPatientToMPI) called"/>
</log>
<sequence key="patient_toMPI_sTransform"/>
</inSequence>
</target>
</proxy>
Simple fix :) Simply go to "Edit Data Service" and tick http and https on "Transport Settings"
This has already been reported as a bug here. It will be resolved in future releases.
Are you logged in as the super tenant? If so you should not be getting this issue. Aforementioned bug, we experienced only in tenant-mode.
Please make sure, you have copied required (correct) client libraries into repository/components/lib directory in ESB to allow connection between the ESB and the JMS provider.
For eg: If the provider is active-mq, you need to copy following jar files.
activemq-core-xxx.jar AND geronimo-j2ee-management_xx_spec-xx.jar

WSO2 ESB 4.5.0 vfs TransportSender as Endpoint Errors with 'Access is denied'

I am trying to put together a proof of concept for the use of wso2 esb. The proof of concept will rely on the ESB picking up a csv file dropped into a folder, converting the details to xml, posting them to a 3rd party web service, then converting the response, which should contain the binary for a pdf, into a pdf and dropping it into a folder.
The current problem with this is that when I configure a folder as an endpoint in wso2 esb 4.5.0, any file that I send to that end-point errors. A stripped down version of my configuration is as defined below: -
<proxy name="PDFPoller"
transports="vfs"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<log level="custom">
<property name="status" value="PDF Receieved"/>
</log>
<log level="full"/>
<property name="transport.vfs.ReplyFileName"
expression="test1.pdf"
scope="transport"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint name="FileEpr">
<address uri="vfs:file:///c:/wso2/processed"/>
</endpoint>
</send>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///C:/wso2/output</parameter>
<parameter name="transport.vfs.FileURI">file:///C:/wso2/PollFolder</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///C:/wso2/Failed</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.pdf</parameter>
<parameter name="transport.vfs.ContentType">application/pdf</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
The error that I get from the ESB is as follows: -
2012-10-29 09:46:00,642 [-] [Axis2 Task] ERROR VFSTransportSender IO Error while
org.apache.commons.vfs2.FileSystemException: Could not write to "file:///c:/wso2/processed".
at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1440)
at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:462)
at org.apache.synapse.transport.vfs.VFSTransportSender.populateResponseFile(VFSTransportSender.java:232)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:173)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:627)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.FileNotFoundException: c:\wso2\processed (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
at org.apache.commons.vfs2.provider.local.LocalFile.doGetOutputStream(LocalFile.java:220)
at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1432)
... 8 more
I don't believe that the problem is a local folder permissions problem, because I have a) checked the permissions on the folder manually and b) The ESB will move the file that I place in the 'pollfolder' to either 'Output' or 'Processed' if I set the transport.vfs.MoveAfterProcess property to that value, so it is possible to write to both these folders.
Any help would be appreciated.
You configuration seems fine. But I suspect the following section.
<property name="transport.vfs.ReplyFileName"
expression="test1.pdf"
scope="transport"/>
You can try without that property. Then it will create a file as same as the input file name inside the "processed" folder. If it works then try the above property as follows.
<property name="transport.vfs.ReplyFileName"
value="test1.pdf"
scope="transport"/>
As you can see, I have replaced "expression" attribute with "value". Expression should be used when you want to execute something, for example concatenating two strings to build the response file name etc.