org.apache.commons.vfs2.FileSystemException:无法创建文件

时间:2016-08-08 09:37:38

标签: java apache-commons-vfs

我想远程访问文件,我正在使用此代码:

FileObject destn=VFS.getManager().resolveFile(f.getAbsolutePath());
        LOGGER.debug("Object Created" +destn);
        domain, username, password
        UserAuthenticator auth=new StaticUserAuthenticator(domain, userName, password);
        LOGGER.debug("Authenticator Object Created" +auth);

        FileSystemOptions opts=new FileSystemOptions();
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);


        FileObject fo=VFS.getManager().resolveFile(remoteFilePath,opts);

在这一行,我得到一个例外:

org.apache.commons.vfs2.FileSystemException: Could not create file "file:////172.50.33.115/D$/testfile.txt".
    at org.apache.commons.vfs2.provider.AbstractFileObject.createFile(AbstractFileObject.java:382)
    at controller.InputController.doPost(InputController.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at 
Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder "file:////172.50.33.115/D$/".
        at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:436)
        at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1392)
        at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1353)
        at org.apache.commons.vfs2.provider.AbstractFileObject.createFile(AbstractFileObject.java:372)
        ... 22 more
    Caused by: org.apache.commons.vfs2.FileSystemException: Could not create directory "\\172.50.33.115\D$".
        at org.apache.commons.vfs2.provider.local.LocalFile.doCreateFolder(LocalFile.java:158)
        at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:425)
        ... 25 more

我在Windows上运行此代码。 它是一个Web应用程序。

0 个答案:

没有答案