Apache Commons VFS - 无法解析文件

问题描述 投票:2回答:2

VFS方法无法处理在${jboss.server.temp.dir}/local/outgoing中配置的这个URI jboss-beans.xml,它由JBoss解析为"C:\\Download\\jboss-eap-5.1.1\\server\\default\\tmp/local/outgoing"。当我尝试解析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);
java jboss apache-commons-vfs
2个回答
2
投票

我认为它需要文件:scheme,因为错误说它被认为是相对的。


4
投票

对于面临这个问题的其他人:我通过替换摆脱了这个错误

FileSystemManager fsManager = VFS.getManager();

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

这允许我多次使用文件系统管理器,而不会在问题中描述错误。当你完成它时,不要忘记关闭你fsManager

fsManager.close();
© www.soinside.com 2019 - 2024. All rights reserved.