Commons VFS StaticUserAuthenticator Issue

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Commons VFS StaticUserAuthenticator Issue

shabeena.k
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
Reply | Threaded
Open this post in threaded view
|

Re: Commons VFS StaticUserAuthenticator Issue

Gary Gregory-4
Have you tried http://commons.apache.org/vfs/filesystems.html#CIFS?

Gary

On Apr 5, 2012, at 6:23, "shabeena.k" <[hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Commons VFS StaticUserAuthenticator Issue

shabeena.k
Can you specifically tel me what do you want me to try?
Reply | Threaded
Open this post in threaded view
|

RE: Commons VFS StaticUserAuthenticator Issue

Gary Gregory-4
I moved this thread to [hidden email].

Please see my reply there.

Gary

-----Original Message-----
From: shabeena.k [mailto:[hidden email]]
Sent: Thursday, April 05, 2012 7:59 AM
To: [hidden email]
Subject: Re: Commons VFS StaticUserAuthenticator Issue

Can you specifically tel me what do you want me to try?

--
View this message in context: http://apache-commons.680414.n4.nabble.com/Commons-VFS-StaticUserAuthenticator-Issue-tp4534444p4534630.html
Sent from the Commons - Issues mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

RE: Commons VFS StaticUserAuthenticator Issue

shabeena.k
I am sorry but I am a newbie and not able to figure out where this issue has been moved.
Reply | Threaded
Open this post in threaded view
|

RE: Commons VFS StaticUserAuthenticator Issue

Gary Gregory-4
This page: http://commons.apache.org/vfs/mail-lists.html

Describes "Questions related to the usage of Commons VFS should be posted to the User List"

You MUST first subscribe to the User List by sending an email to [hidden email]

Once subscribed, please prefix the subject line of any messages for Commons VFS with [vfs].

Gary

-----Original Message-----
From: shabeena.k [mailto:[hidden email]]
Sent: Thursday, April 05, 2012 8:09 AM
To: [hidden email]
Subject: RE: Commons VFS StaticUserAuthenticator Issue

I am sorry but I am a newbie and not able to figure out where this issue has been moved.

--
View this message in context: http://apache-commons.680414.n4.nabble.com/Commons-VFS-StaticUserAuthenticator-Issue-tp4534444p4534650.html
Sent from the Commons - Issues mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

RE: Commons VFS StaticUserAuthenticator Issue

shabeena.k
Got it.Thanks
ldp
Reply | Threaded
Open this post in threaded view
|

RE: Commons VFS StaticUserAuthenticator Issue

ldp
This post has NOT been accepted by the mailing list yet.
Please, can anyone tell how to avoid the java.net.MalformedURLException: unknown protocol: smb