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
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);发布于 2011-11-05 09:33:09
我认为它需要file: scheme,因为错误表明它是相对的。
发布于 2020-06-13 19:23:43
这是一个很老的问题,但很受欢迎。这个异常是非常普遍的。在我的例子中,这个异常是在上传文件到远程ftp服务器时抛出的。根本原因是类路径中缺少sftp库。就在此异常之前,vfs尝试使用与URI中提到的方案相对应的某个提供程序来解析文件。
对于我的例子,方案是sftp,它试图在类路径上找到jsch库。因为它不在我的类路径上,所以这个异常是thrown.Therefore,所以必须将提供者jar放在类路径上。
发布于 2013-08-10 02:08:35
对于其他面临这个问题的人:我通过替换
FileSystemManager fsManager = VFS.getManager();使用
StandardFileSystemManager fsManager = new StandardFileSystemManager();
fsManager.init();这允许我多次使用文件系统管理器,而不会再收到问题中描述的错误。完成后,不要忘记关闭你的fsManager:
fsManager.close();https://stackoverflow.com/questions/7998574
复制相似问题