首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache Commons VFS - cannot resolveFile

Apache Commons VFS - cannot resolveFile
EN

Stack Overflow用户
提问于 2011-11-04 00:40:11
回答 5查看 16.4K关注 0票数 6

VFS方法无法处理在jboss-beans.xml中配置的此URI ${jboss.server.temp.dir}/local/outgoing,此URI已由JBoss解析为"C:\\Download\\jboss-eap-5.1.1\\server\\default\\tmp/local/outgoing"。当我尝试解析URI并获取文件时,它抛出一个异常。你知道问题出在哪里吗?

Exception

代码语言:javascript
复制
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

代码语言:javascript
复制
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);
EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2011-11-05 09:33:09

我认为它需要file: scheme,因为错误表明它是相对的。

票数 1
EN

Stack Overflow用户

发布于 2020-06-13 19:23:43

这是一个很老的问题,但很受欢迎。这个异常是非常普遍的。在我的例子中,这个异常是在上传文件到远程ftp服务器时抛出的。根本原因是类路径中缺少sftp库。就在此异常之前,vfs尝试使用与URI中提到的方案相对应的某个提供程序来解析文件。

对于我的例子,方案是sftp,它试图在类路径上找到jsch库。因为它不在我的类路径上,所以这个异常是thrown.Therefore,所以必须将提供者jar放在类路径上。

票数 9
EN

Stack Overflow用户

发布于 2013-08-10 02:08:35

对于其他面临这个问题的人:我通过替换

代码语言:javascript
复制
FileSystemManager fsManager = VFS.getManager();

使用

代码语言:javascript
复制
StandardFileSystemManager fsManager = new StandardFileSystemManager();
fsManager.init();

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

代码语言:javascript
复制
fsManager.close();
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7998574

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档