3

I want to access file remotely and I am using this code :

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);

at this line I am getting an exception as :

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

I am running this code on windows. Its a web application.

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Varun Goyal
  • 43
  • 1
  • 6

0 Answers0