如果防火墙打开,Java 7 会阻止 Windows Vista 和 7 上的 FTP 传输。有什么想法吗?
Java 7 阻止 Windows Vista 和 7 上的 FTP 传输。
在 FTP 中,在传输文件之前,必须发送 PORT 或 PASV 命令。一旦发送其中一个命令,Windows 防火墙就会关闭发送该命令的套接字。仅当防火墙打开并且 java.exe 不存在异常时才会发生这种情况。我怀疑这个问题与使用新的 Vista IP 堆栈的 Java 7 有关。
有谁知道如何解决或解决这个问题?我们正在分发一个 Java FTP 库,因此我们显然无法自己添加例外。
例外:
java.net.SocketException: Permission denied: recv failed
JRE 版本信息:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
FOLLOW-UP 1(2011 年 11 月 14 日): Oracle 分析了该问题,发现这似乎是 Windows 防火墙和/或 IPv6 堆栈中的错误。他们设法使用本机 C(即非 Java)应用程序复制该问题,因此这是该错误不在 Java 中的有力证据。他们已经通知了微软,所以现在球在他们的手中。更多详细信息可以在 https://bugs.java.com/bugdatabase/view_bug?bug_id=7077696" 找到。 bug_id=7077696
后续 2(2012 年 7 月 27 日): Oracle 的一位(非常有帮助的)联系人告诉我,该问题现已在 Microsoft 升级。我们希望很快就能看到一些结果。
后续行动 3(2012 年 8 月 15 日): 我们在 Oracle 的联系人告诉我们,Microsoft 已经接受了该错误,并且正在确定其优先级。
后续行动 4(2012 年 9 月 21 日): 微软已经制作了一个补丁,目前正在由甲骨文进行测试。没有关于发布日期的消息。
后续行动 5(2012 年 10 月 11 日): 终于成功了! Microsoft 已公开发布修补程序。他们暗示该修复将包含在未来的通用软件更新中:
“如果您没有受到此问题的严重影响,我们建议您等待包含此修补程序的下一个软件更新。”
Java 7 prevents FTP transfers on Windows Vista and 7.
In FTP, before a file is transferred a PORT or a PASV command must be sent. As soon as one of the commands is sent the Windows Firewall closes the socket that sent it. This only happens if the firewall is on and an exception for java.exe is absent. I suspect this problem is related to Java 7 using the new Vista IP stack.
Does anyone have any ideas how to fix or work around this problem? We're distributing a Java FTP library so we obviously can't add exceptions ourselves.
Exception:
java.net.SocketException: Permission denied: recv failed
JRE version info:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
FOLLOW-UP 1 (14 November 2011):
Oracle has analysed the problem and have found that it seems to be a bug in Windows Firewall and/or the IPv6 stack. They managed to replicate the problem with a native C (i.e. non-Java) app, so this is strong evidence that the bug is not in Java. They have informed Microsoft, so the ball is in their court now. More details can be found at https://bugs.java.com/bugdatabase/view_bug?bug_id=7077696
FOLLOW-UP 2 (27 July 2012):
A (very helpful) contact at Oracle has told me that the issue has now been escalated at Microsoft. We're hoping to see some results soon.
FOLLOW-UP 3 (15 August 2012):
Our contact at Oracle has told us that Microsoft has accepted the bug and is in the process of prioritizing it.
FOLLOW-UP 4 (21 September 2012):
Microsoft has produced a patch that is currently being tested by Oracle. No word on a release date.
FOLLOW-UP 5 (11 October 2012):
Success at last! Microsoft has publicly released a hotfix. They imply that the fix will be included in a general software update in the future:
"if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
该问题是由防火墙的状态FTP过滤器引起的。作为解决方法,您可以通过使用管理员权限执行
netsh advfirewall set global StatefulFTP disable
来禁用它。The problem is caused by the stateful FTP filter of the firewall. As a workaround you can disable it by executing
netsh advfirewall set global StatefulFTP disable
with administrator rights.另一种解决方法是使用以下命令启动 JVM:
Another workaround is to start the JVM with:
我们测试了 Windows 修补程序 http://support.microsoft.com/kb/2754804 并确认它确实解决了问题。
We tested the Windows hotfix http://support.microsoft.com/kb/2754804 and confirmed that it did resolve the problem.
我已向 Oracle 提交了错误报告,请参阅 bugs.sun.com/bugdatabase/view_bug .do?bug_id=7077696
他们将优先级标记为低,这让我认为他们不太了解问题的严重性,即Java/Windows 上的 FTP 损坏。我忘记在错误报告中明确说明这一点。如果其他人认为它应该具有更高的优先级,请在 Oracle 错误报告中添加评论。
我刚刚注意到您也可以为该错误“投票”,因此如果您认为该错误很重要,请投票。
I've submitted a bug report to Oracle, see bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696
They've marked the priority as low, which makes me think that they don't quite understand the magnitude of the problem, i.e. that FTP is broken on Java/Windows. I forgot to state that explicitly in the bug report. If anyone else feels like it should have a higher priority please add a comment to the Oracle bug report.
I just noticed that you can also 'vote' for the bug, so please give it a vote if you agree it's significant.
这个问题可以在没有 JDK7 的情况下演示,当应用程序使用 IPv6 映射的 IPv4 地址时,Windows 7 中的防火墙会阻止 ftp 协议。请参阅https://bugs.java.com/bugdatabase/view_bug?bug_id=7077696 了解更多详细信息和解决方法。
This problem can be demonstrated without JDK7, it's the firewall in Windows 7 blocking the ftp protocol when the application is using IPv6-mapped IPv4 addresses. See https://bugs.java.com/bugdatabase/view_bug?bug_id=7077696 for more details and workarounds.
关于这个问题的博客在这里:
http: //podzemski.com/2011/09/12/java-7-prevents-ftp-transfers-on-windows-when-firewall-is-on/
也许这会引起人们对这个问题的更多认识。
Blogged about the issue here:
http://podzemski.com/2011/09/12/java-7-prevents-ftp-transfers-on-windows-when-firewall-is-on/
Maybe it'll cause some additional awareness of the problem.
实际上Windows 7上JDK7下的TFTP也有同样的问题,MS修补程序确实解决了FTP问题,但仍然不适用于TFTP。看来 Oracle 应该向 MS 报告同样的问题,并获取另一个修补程序来解决 TFTP 问题。
Actually TFTP under JDK7 on windows 7 also have the same problem, the MS hotfix does resolve FTP issue, but still not works for TFTP. Seems Oracle should report the same problem to MS and get another hotfix to resolve TFTP issue as well.
此处通过测试用例报告了相同的错误:
Java 7 套接字异常错误论坛。
这是 Java 7 的问题
The same bug was reported here with a test case:
Java 7 Socket Exception Bug forum.
Its an issue with Java 7
我在使用 IDE Eclipse Neon、JAVA 7 和 Windows 7 Professional 时遇到了同样的问题。尝试将 PDF 文件上传到 FTP 服务器。我通过以管理员身份在CMD中运行以下命令解决了这个问题:
I had the same problem using IDE Eclipse Neon, JAVA 7 and Windows 7 Professional. Trying to upload a PDF file to an FTP server. I solved it by running the following command in CMD as administrator: