Apache Commons VFS - не может разрешить файл - PullRequest
2 голосов
/ 03 ноября 2011

Метод VFS не может обработать этот URI ${jboss.server.temp.dir}/local/outgoing, настроенный в jboss-beans.xml, который разрешен в "C:\\Download\\jboss-eap-5.1.1\\server\\default\\tmp/local/outgoing" с помощью JBoss. Когда я пытаюсь разрешить URI и получить файл, возникает исключение. Есть идеи, в чем может быть проблема?

Exception

17:35:25,024 ERROR [VfsSynchronizerConfImpl] File FromOutgoing cannot be resolved, FileSystemException:
org.apache.commons.vfs2.FileSystemException: Could not find file with URI "C:\Download\jboss-eap-5.1.1\server\default\tmp/local/outgoing" because it is a relative path, and no base URI was provided.
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:719)
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)

DefaultFileSystemManager.class methods

public FileObject resolveFile(final String uri) throws FileSystemException
  -- this method calls the method below

public FileObject resolveFile(final FileObject baseFile, final String uri,
        final FileSystemOptions fileSystemOptions)
        throws FileSystemException
  -- this method cannot process the string and throws
     throw new FileSystemException("vfs.impl/find-rel-file.error", uri);

Ответы [ 2 ]

4 голосов
/ 09 августа 2013

Для других людей, сталкивающихся с этой проблемой: я избавился от этой ошибки, заменив

FileSystemManager fsManager = VFS.getManager();

на

StandardFileSystemManager fsManager = new StandardFileSystemManager();
fsManager.init();

Это позволило мне использовать диспетчер файловой системы несколько раз безПолучение ошибки больше описано в вопросе.Не забудьте закрыть вас fsManager, когда вы закончите с этим:

fsManager.close();
2 голосов
/ 05 ноября 2011

Я думаю, что для этого нужна схема file: потому что ошибка говорит, что она считается относительной.

...