简体   繁体   English

如果启用防火墙,Java 7将阻止Windows Vista和7上的FTP传输。有任何想法吗?

[英]Java 7 prevents FTP transfers on Windows Vista and 7 if firewall is on. Any ideas?

Java 7 prevents FTP transfers on Windows Vista and 7. Java 7阻止Windows Vista和7上的FTP传输。

In FTP, before a file is transferred a PORT or a PASV command must be sent. 在FTP中,在传输文件之前,必须发送PORT或PASV命令。 As soon as one of the commands is sent the Windows Firewall closes the socket that sent it. 一旦发送其中一个命令,Windows防火墙就会关闭发送它的套接字。 This only happens if the firewall is on and an exception for java.exe is absent. 只有在防火墙打开且java.exe的例外不存在时才会发生这种情况。 I suspect this problem is related to Java 7 using the new Vista IP stack. 我怀疑这个问题与使用新的Vista IP堆栈的Java 7有关。

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. 我们正在分发一个Java FTP库,所以我们显然不能自己添加异常。

Exception: 例外:

java.net.SocketException: Permission denied: recv failed

JRE version info: 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 (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. 后续行动1(2011年11月14日): Oracle已经分析了这个问题并发现它似乎是Windows防火墙和/或IPv6堆栈中的一个错误。 They managed to replicate the problem with a native C (ie non-Java) app, so this is strong evidence that the bug is not in Java. 他们设法使用本机C(即非Java)应用程序复制问题,因此这是该错误不在Java中的有力证据。 They have informed Microsoft, so the ball is in their court now. 他们告诉了微软,所以球现在在球场上。 More details can be found at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696 有关详细信息,请访问http://bugs.sun.com/bugdatabase/view_bug.do?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. 后续行动2(2012年7月27日):甲骨文的一位(非常有帮助的)联系人告诉我,这个问题现在已经在微软升级了。 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. 后续行动3(2012年8月15日):我们在Oracle的联系人告诉我们,微软已接受该错误并正在确定其优先级。

FOLLOW-UP 4 (21 September 2012): Microsoft has produced a patch that is currently being tested by Oracle. 后续行动4(2012年9月21日):微软已经制作了一个目前正在由甲骨文测试的补丁。 No word on a release date. 在发布日期没有任何消息。

FOLLOW-UP 5 (11 October 2012): Success at last! 后续行动5(2012年10月11日):终于成功了! 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." “如果您没有受到此问题的严重影响,我们建议您等待包含此修补程序的下一个软件更新。”

The problem is caused by the stateful FTP filter of the firewall. 问题是由防火墙的状态FTP过滤器引起的。 As a workaround you can disable it by executing netsh advfirewall set global StatefulFTP disable with administrator rights. 作为一种解决方法,您可以通过执行netsh advfirewall set global StatefulFTP disable具有管理员权限的netsh advfirewall set global StatefulFTP disable来禁用它。

I've submitted a bug report to Oracle, see bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696 我已经向Oracle提交了一个错误报告,请参阅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, ie that FTP is broken on Java/Windows. 他们将优先级标记为低,这让我觉得他们不太了解问题的严重程度,即FTP在Java / Windows上被破坏了。 I forgot to state that explicitly in the bug report. 我忘了在bug报告中明确说明。 If anyone else feels like it should have a higher priority please add a comment to the Oracle bug report. 如果其他人觉得它应该具有更高的优先级,请在Oracle错误报告中添加注释。

I just noticed that you can also 'vote' for the bug, so please give it a vote if you agree it's significant. 我刚刚注意到你也可以对这个错误进行“投票”,所以如果你同意这个错误,请给它投票。

另一种解决方法是使用以下命令启动JVM:

-Djava.net.preferIPv4Stack=true

我们测试了Windows修补程序http://support.microsoft.com/kb/2754804并确认它确实解决了该问题。

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. 没有JDK7可以证明这个问题,当应用程序使用IPv6映射的IPv4地址时,Windows 7中的防火墙阻止了ftp协议。 See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696 for more details and workarounds. 有关更多详细信息和解决方法,请参见http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696

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. 实际上Windows 7下的JDK7下的TFTP也有同样的问题,MS修补程序确实解决了FTP问题,但仍不适用于TFTP。 Seems Oracle should report the same problem to MS and get another hotfix to resolve TFTP issue as well. 似乎Oracle应该向MS报告相同的问题,并获得另一个修补程序来解决TFTP问题。

Blogged about the issue here: http://podzemski.com/2011/09/12/java-7-prevents-ftp-transfers-on-windows-when-firewall-is-on/ 有关此问题的博客: 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. 也许它会引起一些额外的问题意识。

The same bug was reported here with a test case: Java 7 Socket Exception Bug forum. 这里报告了一个带有测试用例的错误Java 7 Socket Exception Bug论坛。 Its an issue with Java 7 它是Java 7的一个问题

I had the same problem using IDE Eclipse Neon, JAVA 7 and Windows 7 Professional. 我使用IDE Eclipse Neon,JAVA 7和Windows 7 Professional遇到了同样的问题。 Trying to upload a PDF file to an FTP server. 尝试将PDF文件上传到FTP服务器。 I solved it by running the following command in CMD as administrator: 我通过在CMD中以管理员身份运行以下命令来解决它:

C: \ Users \ pc01> netsh advfirewall set global StatefulFTP disable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以编程方式向 windows vista 防火墙添加例外 - Programmatically Add Exception to windows vista firewall 以编程方式将应用程序添加到所有配置文件Windows防火墙(Vista +) - Programmatically add an application to all profile Windows Firewall (Vista+) Java 应用程序和 Windows 防火墙 - Java Application and Windows Firewall Windows 防火墙不允许 Java 应用程序 - Windows Firewall Not Allowing Java Application Java应用程序在Windows Vista及更高版本上进行自我更新 - Java application updating itself on Windows Vista and higher Windows上的usb4java:控件传输意外失败 - usb4java on Windows: control transfers fail unpredictably 在Windows Vista / 7中对任何给定的窗口(不是全部)禁用透明 - Disable transparency for any given window (not for all) in Windows Vista/7 在Windows Vista上发出任何rails命令时发生延迟 - Delay when issuing any rails commands on windows vista 是否有适用于 Windows XP/Vista/7 和 OSX 并确保安装 Java 的安装程序生成器? - Is there an installer builder that works for Windows XP/Vista/7 and OSX, and that ensures Java is installed? 如何检测是否有任何进程阻止 Windows 进入睡眠状态? - How to detect if any of the process prevents Windows from sleep?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM