我收到此错误,我在程序中所做的唯一更改是将参数硬编码为
String hostName = "122.183.217.133" ;
String username = "root";
String password = "something";
String localFilePath = "C://Sample.jpg";
String remoteFilePath = "/var/www/html/intranetupload/uploads/Sample.jpg";
Jun 25, 2012 2:52:18 PM org.apache.commons.vfs2.VfsLog info
INFO: Using "C:\DOCUME~1\MEENAK~1.DCK\LOCALS~1\Temp\vfs_cache" as temporary files store.
Exception in thread "main" java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://root:***@122.183.217.133:22/var/www/html/intranetupload/uploads/Sample1.jpg".
at sftp.sample.Main.delete(Main.java:120)
at sftp.sample.Main.main(Main.java:36)
Caused by: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://root:***@122.183.217.133:22/var/www/html/intranetupload/uploads/Sample1.jpg".
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:61)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:621)
at sftp.sample.Main.delete(Main.java:111)
... 1 more
Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://root:***@122.183.217.133:22/var/www/html/intranetupload/uploads/Sample1.jpg".
at org.apache.commons.vfs2.provider.HostFileNameParser.extractToPath(HostFileNameParser.java:155)
at org.apache.commons.vfs2.provider.URLFileNameParser.parseUri(URLFileNameParser.java:50)
at org.apache.commons.vfs2.provider.AbstractFileProvider.parseUri(AbstractFileProvider.java:188)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:57)
... 4 more
我没有服务器的域名。我所拥有的只是一台已知 IP / 用户名和密码的 ubuntu 机器。我的工作需要删除远程 Ubuntu 机器上的文件。
你能帮我解决这个错误吗?