You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jorge (Jira)" <ji...@apache.org> on 2019/09/27 10:45:00 UTC

[jira] [Created] (VFS-730) Error while creating a file/folder on a shared network folder using StaticUserAuthenticator

Jorge created VFS-730:
-------------------------

             Summary: Error while creating a file/folder on a shared network folder using StaticUserAuthenticator
                 Key: VFS-730
                 URL: https://issues.apache.org/jira/browse/VFS-730
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.4.1
         Environment: The code works fine on develomnet environment where the user running tomcat is a local user, but fails when the user running tomcat is the SYSTEM user. 

Our guess is that in the first situation copyFrom is not using the Authenticator and therefore works fine. 

The targetPath is in a shared folder on a server with W{color:#000000}indows 2008 R2 standard, The folder has permissions to read and write and we already check that is accesible from the computer running apache.{color}

When the execution reach the copyFrom line is fire a FileSystemException:

org.apache.commons.vfs2.FileSystemException: Could not copy "file:///C:/localpath/file.txt" to "file:////192.168.1.1/targetFolder/file.txt".

 
            Reporter: Jorge


The following code is failing to create the target file:

 
{code:java}
	private void copyUsingCredentials(Path sourcePath, Path targetPath) throws IOException {
        String domain = "domain";
        //String domain = "192.168.1.1"; 
        String username = "username";
        String password = "1234";
        
	    FileObject sourceFile = VFS.getManager().resolveFile(sourcePath.toFile().getAbsolutePath());

	    StaticUserAuthenticator auth = new StaticUserAuthenticator(domain, username, password);
	    FileSystemOptions opts = new FileSystemOptions();
	    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);

	    FileObject targetFile = VFS.getManager().resolveFile(targetPath.toFile().getAbsolutePath(), opts);

	    targetFile.copyFrom(sourceFile, Selectors.SELECT_SELF);
	    targetFile.close();

	}
{code}
 
{code:java}
sourcePath = file:///C:/localpath/file.txt

targetPath = file:////192.168.1.1/targetFolder/file.txt{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)