commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "geek.shrek" <>
Subject How to create file with samba vfs?
Date Wed, 11 Nov 2009 00:17:19 GMT

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(
Caused by: org.apache.commons.vfs.FileSystemException: Could not determine the type of file
    at org.apache.commons.vfs.provider.AbstractFileObject.attach(
    at org.apache.commons.vfs.provider.AbstractFileObject.getType(
    at org.apache.commons.vfs.provider.AbstractFileObject.exists(
    at org.apache.commons.vfs.provider.AbstractFileObject.createFile(
    ... 2 more
Caused by: jcifs.smb.SmbException: The system cannot find the file specified.
    at jcifs.smb.SmbTransport.checkStatus(
    at jcifs.smb.SmbTransport.send(
    at jcifs.smb.SmbSession.send(
    at jcifs.smb.SmbTree.send(
    at jcifs.smb.SmbFile.send(
    at jcifs.smb.SmbFile.open0(
    at jcifs.smb.SmbFileInputStream.<init>(
    at jcifs.smb.SmbFileInputStream.<init>(
    at jcifs.smb.SmbFile.getInputStream(
    at org.apache.commons.vfs.provider.url.UrlFileObject.doGetType(
    at org.apache.commons.vfs.provider.AbstractFileObject.attach(
    ... 5 more

Here is my code.

FileSystemManager fsManager;
            fsManager = VFS.getManager();
            FileObject sourceFile = fsManager.resolveFile("smb://MYDOMAIN;myusername:mypassword@sharefolder/Folder1/myfolder",authenticate());
            FileObject f = sourceFile.resolveFile("Test2/myfile.txt"); 
        catch (FileSystemException e)

Can someone please help me 

Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now:
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message