Support Questions

Find answers, ask questions, and share your expertise

How to access file present in network shared drive with credentials in nifi?

avatar

I have NiFi instance 1.3.0 running on my local Windows. I want to copy a file from a one network drive to FTP.

I think getFile processor reads files inside share directory

//server/shared/path/to/file.

Normally my shared drive prompts for credentials before access folder.

I tried getFile processor for access shared drive without credentials it worked.

But it not worked if credentials asked for network drive.

Can anyone suggest way to access network drive folder with credentials and move it into FTP using NiFi processors?

@wayne
I tried with GetFTP but it shows below error

ERROR [Timer-Driven Process Thread-9] o.apache.nifi.processors.standard.GetFTP GetFTP[id=5080b2bd-015e-1000-1f94-1e8811e88742] Unable to fetch listing from remote server due to java.net.ConnectException: Connection timed out: connect: {} java.net.ConnectException: Connection timed out: connect at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.commons.net.SocketClient.connect(SocketClient.java:182) at org.apache.nifi.processors.standard.util.FTPTransfer.getClient(FTPTransfer.java:532) at org.apache.nifi.processors.standard.util.FTPTransfer.getListing(FTPTransfer.java:191) at org.apache.nifi.processors.standard.util.FTPTransfer.getListing(FTPTransfer.java:155) at org.apache.nifi.processors.standard.GetFileTransfer.fetchListing(GetFileTransfer.java:284) at org.apache.nifi.processors.standard.GetFileTransfer.onTrigger(GetFileTransfer.java:127) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120) at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147) at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

10 REPLIES 10

avatar
@haM@

The GetFile processor doesn't have properties that allow entering user credentials.

Have you tried using GetFTP to access the files and then use PutFTP processor to move the file?

Configure the GetFTP like this

34692-screen-shot-2017-09-06-at-13419-pm.png

avatar

21 is FTP port.It couldn't work for network shared drive ports(139,445)

avatar

@Wynner

I haved added error faced while using getFTP for access sharedDrive

avatar
@haM@

Are you able to manually ftp to the server with the user credentials?

Also, you can change the port the processor uses for the ftp connection.

avatar

@Wynner,

I am not mean that accessing data from FTP Server.

i mean that to get file from UNC Path(//servername/folder) and move that into FTP Server.

i don't know in this case how getFTP works?

avatar
@haM@

If the shared drive requires user credentials to access it, then the GetFile processor will not work in this case.

What do you mean by "It couldn't work for network shared drive ports(139,445)"?

avatar

@Wynner.

I mean that network shared drive access in GetFTP not worked.For FTP server port is 21 that is configured GetFTP processor.But network shared drive ports are 139,445.In your answer you have specified 21 port in GetFTP. That's why i said FTP processor not work for multiple ports used by UNC Path.

avatar
@haM@

In the GetFTP processor, you can change that property to use a different port. Try using 139 or 445 to see if it works?

avatar
New Contributor

This is a very well written post, my compliments. I’m glad to find your post. Keep sharing this type of stuff. foil containers suppliers