Mule File Transport to Read files from Windows SMB Share - windows

I am trying to write a file to a Windows SMB share.
The Mule File Transport documentation says that I should be able to access a Windows Location as follows:
file:////192.168.0.1/temp/
Here is my mule flow: I would like to know if there is a resolution for this. Thanks!
<file:outbound-endpoint responseTimeout="10000" doc:name="File" address="file:////<IPAddress>/ShareName/" outputPattern="hello.xml"/>
I get the following error:
Message : Streaming failed. Could not get output stream. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=file:////<IPAddress>/ShareName/, connector=FileConnector
{
name=connector.file.mule.default
lifecycle=start
this=2b1f76e1
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[file]
serviceOverrides=<none>
}
, name='endpoint.file.<IPAddress>.ShareName', mep=ONE_WAY, properties= {outputPattern=hello.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. No such file or directory (java.io.IOException)
java.io.UnixFileSystem:-2 (null)
2. Streaming failed. Could not get output stream. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=file:////<IPAddress>/ShareName/, connector=FileConnector
{
name=connector.file.mule.default
lifecycle=start
this=2b1f76e1
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[file]
serviceOverrides=<none>
}
, name='endpoint.file.<IPAddress>.ShareName', mep=ONE_WAY, properties={outputPattern=hello.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.file.FileConnector:569 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.mule.util.FileUtils.createFile(FileUtils.java:93)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

Using the file transport to access a UNC path works when Mule is executing on a Windows operating system.
Since it seems that you are in a Unix machine you will have to use the CIFS/SMB protocol.
There is a community supported module called mule-transport-cifs that can help you with this.
After adding this module to your project you should be able to use it by chaning the file outbound-enpdoint to something like this.
<smb:outbound-endpoint host="<IPAddress>" user="username" password="secret" path="/ShareName" outputPattern="hello.xml"/>

Related

JSCH to connect to remote server to download files is giving error failed to send channel request

I am using jsch to download filed from a remote server to local server. Below is the code segment to download the files:
Channel channel = session.openChannel("sftp");
channel.connect(channelTimeout);
channelSftp.connect(10000);
channelSftp.cd(remoteDir);
for (Object entry : channelSftp.ls(remoteDir)) {
if (entry instanceof ChannelSftp.LsEntry) {
String filename = ((ChannelSftp.LsEntry) entry).getFilename();
if (!filename.equals(".") && !filename.equals("..")) {
channelSftp.get(filename, localDir + filename);
}
}
}
but each time I run the code i am getting the below error:
20:44:09.205 [main] ERROR - Error download file
com.jcraft.jsch.JSchException: failed to send channel request
at com.jcraft.jsch.Request.write(Request.java:65)
at com.jcraft.jsch.RequestSftp.request(RequestSftp.java:47)
at com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:237)
at com.jcraft.jsch.Channel.connect(Channel.java:152)
The weird part is if I run the application in debug mode, I am not getting any error and the application completes successfully.
Can anyone help why this error is occurring only while running and not while debugging.
note - I am using spring boot application.

FTP connectivity issue from Mule

I am receiving the below error while connecting the FTP path for file transfer through
Mulesoft code and it is worked for so many days, unfortunately, we received this error from a
couple of dys. So please help me to fix this.
Error
Message: An exception was found trying to obtain a connection: Found exception trying to change transfer mode to class org.mule.extension.ftp.api.ftp.FtpTransferMode. FTP reply code is: 421
Element : ac-ngwtransform-ftp-v1Flow/processors/6/processors/0/route/0/processors/1 # azx-us-int-ac-ngwtransform-ftp-v1:ac-ngwtransform-ftp-v1.xml:84 (Reading the file from FTP)
Element XML : <ftp:read doc:name="Reading the file from FTP" doc:id="da9be7af-d84b-4a78-a8ce-cd9f117aa273" config-ref="FTP_Config_NGW" path="#[attributes.fileName]" outputMimeType="text/plain"></ftp:read>
Error type : FTP:CONNECTIVITY
Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received.
you can use reconnection strategy to fix this issue.
go to your ftp connector-->advance->click reconnection and make the reconnection strategy standard.

File upload stuck on large files with Spring Web on Windows

I have a JHipster application providing a REST endpoint for uploading files.
This code works without any problem in a Docker container on a Linux machine but seems to be stuck in the same Docker container running on Windows.
#PostMapping("/datafiles")
#Timed
public ResponseEntity<DataFileDTO> createDataFile(#Valid #RequestParam("file") MultipartFile data,
#Valid #RequestHeader("workspaceId") Long workspaceId, RedirectAttributes redirectAttributes)
throws URISyntaxException, IOException {
log.debug("REST request to save a data content");
DataFileDTO result = dataFileService.createFromData(data, workspaceId);
return ResponseEntity.created(new URI("/api/datafiles/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
This code works for 12Mb video file but when I try to upload a file which is 70Mb, no debug log appears and the server is blocked until I get a timeout from undertow
Jan 29 15:26:46 StorageService StorageService-dockerstorage_storageservice-app_1.network:8081: ERROR - io.undertow.request : UT005023: Exception handling request to /api/datafiles
java.io.IOException: UT000128: Remote peer closed connection before all data could be read
at io.undertow.conduits.FixedLengthStreamSourceConduit.exitRead(FixedLengthStreamSourceConduit.java:338)
at io.undertow.conduits.FixedLengthStreamSourceConduit.read(FixedLengthStreamSourceConduit.java:255)
at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)
at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2343)
at org.xnio.channels.Channels.readBlocking(Channels.java:294)
at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:192)
at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:168)
at io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.parseBlocking(MultiPartParserDefinition.java:223)
at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:792)
... 43 common frames omitted
Changing the timeout just leaves the server waiting but nothing happens on my part of code.
Is there something specific to Windows in this case ?
I finally found that the problem is not on the JHipster side but is related to the configuration of the NGinx Docker container running the frontend.
It seems that the default configuration is different in this case.

Apache Directory Authentication Failed?

I am trying to connect the OpenLdap through Apache Directory Studio and its working upto Network Parameter and check Network Parameter working fine.
But Next step i am trying to Authentication and its failed with below message.
The authentication failed
- The response queue has been emptied, no response was found. org.apache.directory.api.ldap.model.exception.LdapException: The
response queue has been emptied, no response was found. at
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1327)
at
org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$2.run(DirectoryApiConnectionWrapper.java:368)
at
org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1269)
at
org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doBind(DirectoryApiConnectionWrapper.java:460)
at
org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.bind(DirectoryApiConnectionWrapper.java:306)
at
org.apache.directory.studio.connection.core.jobs.CheckBindRunnable.run(CheckBindRunnable.java:79)
at
org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:127)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by:
org.apache.directory.api.ldap.model.exception.LdapException: TimeOut
occurred at
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1305)
... 7 more
The response queue has been emptied, no response was found.

There was an authentication failure. "Failed to decode the S/MIME message. The S/MIME message may not be valid."

Created a simple XMLreceive Pipeline (added XMLassembler with Document Schema and Envelope Schema) and Passthru Send Pipeline. Set "Allow non MIME Message" to TRUE, "Check revokation list" to "TRUE/FALSE" in MIME/SMIME Decoder.
Deployed to BizTalk 2010 Server (Windows Server 2008 R2 and Sql Server 2008 ).
Configured Receive and Send Ports in BizTalk server. Getting the following error. I have tried by removing MIME/SMIME Decoder still same error
There was a failure executing the receive pipeline: "Messaging.ReceivePurchaseOrders, Messaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b1e04cc8b8d2213c" Source: "MIME/SMIME decoder" Receive Port: "M6RcvPrt-1" URI: "C:\BizTalk\Demo-Module6\IN*.xml" Reason: There was an authentication failure. "Failed to decode the S/MIME message. The S/MIME message may not be valid.".
XML File :
<ns0:ItemList xmlns0:ns0="http://Messaging.InterchangeEnvelope">
<ns0:ItemHeader>
<ns0:Sender>Contoso</ns0:Sender>
<ns0:BatchNumber>125</ns0:BatchNumber>
</ns0:ItemHeader>
<ns0:Items>
<ns0:Item ID="1524856" xmlns:ns0="http://Messaging.InterchangeBody">
<ns0:QTY>10</ns0:QTY>
<ns0:Price>30</ns0:Price>
</ns0:Item>
<ns0:Item ID="1524857" xmlns:ns0="http://Messaging.InterchangeBody">
<ns0:QTY>10</ns0:QTY>
<ns0:Price>40</ns0:Price>
</ns0:Item>
<ns0:Item ID="1524858" xmlns:ns0="http://Messaging.InterchangeBody">
<ns0:QTY>10</ns0:QTY>
<ns0:Price>50</ns0:Price>
</ns0:Item>
<ns0:Item ID="1524859" xmlns:ns0="http://Messaging.InterchangeBody">
<ns0:QTY>10</ns0:QTY>
<ns0:Price>60</ns0:Price>
</ns0:Item>
</ns0:Items>
</ns0:ItemList>

Resources