Apache VFS 的 SSH URI 错误

发布于 2024-12-28 10:04:59 字数 3862 浏览 0 评论 0原文

我在使用 Apache VFS 的 Android 应用程序中遇到以下错误,并且我在 google 上找不到太多帮助。我正在尝试通过 SSH 上传文件,但收到这个相当模糊的错误。根据 VFS 文档,logcat 中报告的 URI 对我来说看起来是正确的。我唯一能想到的是它只期望看到本地网络主机而不是 TLD。这是真的吗?如果是,我该如何解决?如果不是,您觉得这个 URI 有什么问题吗?

Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mydomain.com/public_html/". 

无论有没有特定的目标文件名,错误都是相同的。

这是完整的 logcat 输出。

01-22 19:41:15.660: E/AndroidRuntime(1997): FATAL EXCEPTION: main
01-22 19:41:15.660: E/AndroidRuntime(1997): java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:279)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.testSFTPSite(SiteEditor.java:289)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor$10.onClick(SiteEditor.java:629)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View.performClick(View.java:2532)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View$PerformClick.run(View.java:9293)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.handleCallback(Handler.java:587)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Looper.loop(Looper.java:150)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.app.ActivityThread.main(ActivityThread.java:4263)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invokeNative(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invoke(Method.java:507)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at dalvik.system.NativeStart.main(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:61)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:621)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:265)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 13 more
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.HostFileNameParser.extractToPath(HostFileNameParser.java:155)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.URLFileNameParser.parseUri(URLFileNameParser.java:50)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractFileProvider.parseUri(AbstractFileProvider.java:188)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:57)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 16 more

I'm getting the following error in an Android application with Apache VFS and I can't find much on the google to help. I'm trying to upload a file via SSH and I get this rather vague error. The URI, as reported in logcat, looks correct to me according to the VFS docs. The only thing I can figure is that it only expects to see a local network host instead of a TLD. Is this true, and if so, how do I fix it? If not, what looks wrong about this URI to you?

Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mydomain.com/public_html/". 

The errors are the same with or without a specific destination filename.

Here's the full logcat output.

01-22 19:41:15.660: E/AndroidRuntime(1997): FATAL EXCEPTION: main
01-22 19:41:15.660: E/AndroidRuntime(1997): java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:279)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.testSFTPSite(SiteEditor.java:289)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor$10.onClick(SiteEditor.java:629)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View.performClick(View.java:2532)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View$PerformClick.run(View.java:9293)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.handleCallback(Handler.java:587)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Looper.loop(Looper.java:150)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.app.ActivityThread.main(ActivityThread.java:4263)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invokeNative(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invoke(Method.java:507)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at dalvik.system.NativeStart.main(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:61)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:621)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:265)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 13 more
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.HostFileNameParser.extractToPath(HostFileNameParser.java:155)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.URLFileNameParser.parseUri(URLFileNameParser.java:50)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractFileProvider.parseUri(AbstractFileProvider.java:188)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:57)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 16 more

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难以启齿的温柔 2025-01-04 10:04:59

我怀疑您的密码中存在有问题的字符(因为这是唯一未显示的信息)。您需要先对用户名和密码进行百分比编码,然后再将其添加到 URL。

I suspect you have a problematic character in the password (as this is the only info not shown). You need to percent-encode the username and password before adding it to the URL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文