You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ralph Goers <ra...@dslextreme.com> on 2009/11/11 04:04:06 UTC

[VFS] Re: How to create file with samba vfs?

What version of VFS are you using? I would suggest you check out trunk and try that.


On Nov 10, 2009, at 4:17 PM, geek.shrek wrote:

> Hi,
> 
> I'm trying to build some functions for samba, such as create file, delete, etc.
> I can read a file from my samba, but when I tried to create or delete I keep having this error
> 
> 
> org.apache.commons.vfs.FileSystemException: Could not create file "smb://MYDOMAIN;myusername:mypassword@sharefolder/Folder1/myfoldert/Test2/myfile.txt".
>    at org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileObject.java:797)
>    ...
> Caused by: org.apache.commons.vfs.FileSystemException: Could not determine the type of file "smb://MYDOMAIN;myusername:mypassword@sharefolder/Folder1/myfolder/Test2/myfile.txt".
>    at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1305)
>    at org.apache.commons.vfs.provider.AbstractFileObject.getType(AbstractFileObject.java:412)
>    at org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:402)
>    at org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileObject.java:780)
>    ... 2 more
> Caused by: jcifs.smb.SmbException: The system cannot find the file specified.
>    at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
>    at jcifs.smb.SmbTransport.send(SmbTransport.java:644)
>    at jcifs.smb.SmbSession.send(SmbSession.java:224)
>    at jcifs.smb.SmbTree.send(SmbTree.java:111)
>    at jcifs.smb.SmbFile.send(SmbFile.java:770)
>    at jcifs.smb.SmbFile.open0(SmbFile.java:975)
>    at jcifs.smb.SmbFile.open(SmbFile.java:992)
>    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:73)
>    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:65)
>    at jcifs.smb.SmbFile.getInputStream(SmbFile.java:2826)
>    at org.apache.commons.vfs.provider.url.UrlFileObject.doGetType(UrlFileObject.java:89)
>    at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1296)
>    ... 5 more
> 
> 
> Here is my code.
> 
> FileSystemManager fsManager;
>        try
>        {
>            fsManager = VFS.getManager();
>            FileObject sourceFile = fsManager.resolveFile("smb://MYDOMAIN;myusername:mypassword@sharefolder/Folder1/myfolder",authenticate());
> 
>            FileObject f = sourceFile.resolveFile("Test2/myfile.txt"); 
>            f.createFile();
>        }
>        catch (FileSystemException e)
>        {
>            e.printStackTrace();
>        }
> 
> Can someone please help me 
> Thanks,
> 
> 
> 
>      __________________________________________________________________________________
> Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
> Enter now: http://au.docs.yahoo.com/homepageset/


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