commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <GGreg...@rocketsoftware.com>
Subject Re: Commons VFS StaticUserAuthenticator Issue
Date Thu, 05 Apr 2012 11:12:50 GMT
Have you tried http://commons.apache.org/vfs/filesystems.html#CIFS?

Gary

On Apr 5, 2012, at 6:23, "shabeena.k" <shabeena.khoja@etpgroup.com> wrote:

> Hi All,
> 
> I am using the Commons VFS API for accessing resources from a remote machine
> over LAN.
> However, it doesn't work for one of the cases,details of which are listed
> below:
> 
> A directory containing files exists on the remote machine.However,this
> directory is not shared.Other machine tries to access this folder with the
> username and password used to connect to this machine.But this turns out to
> be a failure.The snippet of this is given below:
> 
> StaticUserAuthenticator mwwObjStaticUserAuth = new   
> StaticUserAuthenticator(mwwStrLANUsername,mwwStrLANPassword, null);
> FileSystemOptions mwwObjileSystemOptions = new FileSystemOptions(); 
> 
> DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(mwwObjileSystemOptions,
> mwwObjStaticUserAuth);
>                
> FileSystemManager fsManager = VFS.getManager();
> 
> String path =
> "//"+mwwStrSourceMachine+File.separator+mwwStrFolderPath+File.separator+"filename";
> FileObject folder = fsManager.resolveFile(path,mwwObjileSystemOptions);
> FileContent cwwObjFileContent  = folder.getContent();
> // more logic to download file on local machine    
> 
> But this leads to a FileNotFoundException, the entire trace is shown below:
> 
> 
> org.apache.commons.vfs2.FileNotFoundException: Could not read from
> "file:////WS-005/E:/abc/xyz/site-1.6.12.zip" because it is a not a file.
>    at
> org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1315)
>    at
> org.apache.commons.vfs2.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:396)
>    at landownload.Snippet.download(Snippet.java:63)
>    at landownload.Snippet.main(Snippet.java:23)
> Caused by: java.io.FileNotFoundException:
> \\WS-005\E:\abc\xyz\site-1.6.12.zip (The network path was not found)
>    at java.io.FileInputStream.open(Native Method)
>    at java.io.FileInputStream.<init>(FileInputStream.java:106)
>    at
> org.apache.commons.vfs2.provider.local.LocalFile.doGetInputStream(LocalFile.java:209)
>    at
> org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1307)
>    ... 3 more
> 
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/Commons-VFS-StaticUserAuthenticator-Issue-tp4534444p4534444.html
> Sent from the Commons - Issues mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message