我在 Apache Tomcat 6.0.36 上运行 Web 应用程序,并使用 IE8 作为带有 Windows 7 的 Web 浏览器。我最近应用了 Java 零日补丁 (Java 7 Update 11)。
现在我所有的 Web 应用程序都出现白屏并显示消息“Internet Explorer 无法显示该网页”这是我从 catalina 日志文件中获得的错误消息。
Jan 18, 2013 3:44:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 38198 ms
Jan 18, 2013 3:51:17 PM org.apache.tomcat.util.net.NioEndpoint setSocketOptions
SEVERE:
java.net.SocketException: Invalid argument: no further information
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setSocketOption(Unknown Source)
at sun.nio.ch.SocketChannelImpl.setOption(Unknown Source)
at sun.nio.ch.SocketAdaptor.setIntOption(Unknown Source)
at sun.nio.ch.SocketAdaptor.setTrafficClass(Unknown Source)
at org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:184)
at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:1089)
at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1314)
at java.lang.Thread.run(Unknown Source)
非常感谢任何有关如何解决此问题的想法。
谢谢。
原因是 setTrafficClass 调用和咬了同样的子弹一次。如果您使用 Java6 来运行 Tomcat 进程,它应该可以工作。与 Windows 网络堆栈功能有关。某些应用程序提供属性“skipTrafficClass_call=true”,但这是应用程序行为的一部分。这是一个非常老的问题,但 Java7 做了一个小而重要的改变。
引自网络:
"I've tracked down the first of these issues. Calling
java.nio.channels.SocketChannel.socket().setTrafficClass() after
socketChannel.connect() has been called triggers a SocketException.
Moving the setTrafficClass() call to before connect() fixes the
issue." " Tests on Java 6 show that the setTrafficClass() was having
no effect if called after connect(). It looks like Java 7 has started
to throw an exception when the setter has no effect."
A number of developers on the JDC have posted comments to indicate
that the ToS bits are not set on Windows 2000 and XP. This is not a
bug in the setTrafficClass implementation but rather that the IP_TOS
option must be enabled by creating a registry setting. The registry
setting is :-
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\DisableUserTOSSetting
http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#setTrafficClass%28int%29
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4696356
http://tomcat.10.n6.nabble.com/Tomcat-7-Cluster-Issue-td4562937.html
您可以为连接器尝试较旧的 Http11Protocol 处理程序,这在 tomcat/conf/server.xml 文件中给出。更改 http(8080) 和 https(8443) 连接器。
<!-- protocol: org.apache.coyote.http11.Http11Protocol, same as HTTP/1.1
org.apache.coyote.http11.Http11NioProtocol
org.apache.coyote.http11.Http11AprProtocol
-->
<Connector port="8080" protocol="org.apache.coyote.http11.Http11Protocol"
connectionTimeout="20000" redirectPort="8443"
disableUploadTimeout="true" useBodyEncodingForURI="true" />
编辑 似乎 Tomcat 7.0.30+ 解决了这个问题,您可以使用 Windows+Java7+Tomcat7+NIO 连接器。从现在开始,所有 java 网络应用程序都应该在打开连接之前设置可选的套接字选项,Java6 允许免费通过,但 Java7 会抛出异常。
http://svn.apache.org/viewvc?view=revision&revision=1358591