3

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

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 上运行此代码。它是一个网络应用程序。

4

0 回答 0