如果tomcat运行在IPV6启用的服务器环境中,比如windows server 2008,如果用IPV4的地址去访问8080端口,连接将会失败。即使在hosts文件中配置了::
localhost127.0.0.1
localhost也是没有效果的。因为这是tomcat的问题,我们需要在tomcat目录下,将server.xml中的address指定为使用IPV4,详细配置可以参考如下I
found that there was a bug with Tomcat 5 running on Windows server 2008 64 bit. It attempts to use IPv6 over the default IPv4.To
resolve it, open up the Server.xml file and search for "<Connector". The top Connector will have the port that you're trying to communicate through, in my case 8080. In between port="8080" maxHttpHeaderSize="8192" type address="0.0.0.0" (Line will look likeport="8080"
address="0.0.0.0" maxHttpHeaderSize="8192").Restart
Tomcat and you should be good to go.即在端口配置项中,添加address="0.0.0.0"
尝试使用request.getRemoteAddr()时获得ipv6地址:0.0.0.0.0.0.0.1的解决方法
最新推荐文章于 2024-07-21 03:57:38 发布
本文详细介绍了如何解决Tomcat5在Windows Server 2008环境下使用IPv4地址访问IPv4端口时出现的连接失败问题。通过修改server.xml文件中的address属性为'0.0.0.0',可确保IPv4端口正常工作。
1823

被折叠的 条评论
为什么被折叠?



