2
votes

I have a Mule flow that reads files through a generic inbound endpoint from an ftp server, makes some modification on the data, and writes files through a generic outbound endpoint to an sftp server. Yesterday it processed 60 files. On 57 there were no errors, but on three the following traces appeared. Any suggestions are welcome.

Error writing data over SFTP service, error was: Failed to open local file
4: Failed to open local file
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2297)
    at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:484)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:438)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:405)
    at org.mule.transport.sftp.SftpClient.storeFile(SftpClient.java:385)
    at org.mule.transport.sftp.SftpMessageDispatcher.doDispatch(SftpMessageDispatcher.java:176)
    at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:100)
    at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2553)
    at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
    at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:111)
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:158)
    at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    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:619)
[ERROR] DispatchingLogger [Services].xmlSftpConnector.dispatcher.29 2014-06-09 15:55:07 Unexpected exception attempting to write file, message was: Failed to open local file
java.io.IOException: Failed to open local file
    at org.mule.transport.sftp.SftpClient.storeFile(SftpClient.java:390)
    at org.mule.transport.sftp.SftpMessageDispatcher.doDispatch(SftpMessageDispatcher.java:176)
    at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:100)
    at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2553)
    at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
    at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:111)
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:158)
    at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    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:619)
[WARN] SftpUtil [Services].xmlSftpConnector.dispatcher.29 2014-06-09 15:55:07 Class java.io.ByteArrayInputStream did not implement the 'ErrorOccurred' decorator, errorOccured=true could not be set.
[ERROR] DispatchingLogger [Services].xmlSftpConnector.dispatcher.29 2014-06-09 15:55:07 
********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=sftp://user:<password>@server.com/folder/test/upload, connector=SftpConnector
{
  name=xmlSftpConnector
  lifecycle=start
  this=cfc9fac
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[sftp]
  serviceOverrides=<none>
}
,  name='endpoint.sftp.server.com.22.folder.test.upload', mep=ONE_WAY, properties={outputPattern=#[function:datestamp:dd-MM-yy]_#[function:systime].xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: String
Code                  : MULE_ERROR-42999
--------------------------------------------------------------------------------
Exception stack is:
1. Failed to open local file (java.io.IOException)
  org.mule.transport.sftp.SftpClient:390 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=sftp://user:<password>@server.com/folder/test/upload, connector=SftpConnector
{
  name=xmlSftpConnector
  lifecycle=start
  this=cfc9fac
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[sftp]
  serviceOverrides=<none>
}
,  name='endpoint.sftp.server.com.22.folder.test.upload', mep=ONE_WAY, properties={outputPattern=#[function:datestamp:dd-MM-yy]_#[function:systime].xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: String (org.mule.api.transport.DispatchException)
  org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.IOException: Failed to open local file
    at org.mule.transport.sftp.SftpClient.storeFile(SftpClient.java:390)
    at org.mule.transport.sftp.SftpMessageDispatcher.doDispatch(SftpMessageDispatcher.java:176)
    at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:100)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
1
What are the filenames that failed?Tracy Snell
@TracySnell: I can't disclose the names. However, all the files were processed again successfully with the same names.Andres
How large are the (failing) files? It appears to be a problem on your local (temp) filesystem - is that running low on free space?Anders R. Bystrup
@AndersR.Bystrup All the files are around 7k, and free space is not a problem.Andres

1 Answers

1
votes

It looks like one of 3 reasons:

  1. Permissions on the folder you're writing to.
  2. Spaces on the file path (or name).
  3. Wrong slash in the file path.

EDIT based on comment.

You can try configuring maxThreadsActive to limit the no of threads active at a time.

<dispatcher-threading-profile maxThreadsActive="5" maxThreadsIdle="5"/>