• win7下tomcat5.5无法通过ip和127.0.0.1访问的解决方法


     解决办法:找到tomcat5.5目录下的conf\server.xml文件,原文如下:
    Java代码 <Connector port="8080" maxHttpHeaderSize="8192"  
    1.                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  
    2.                enableLookups="false" redirectPort="8443" acceptCount="100"  
    3.                connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"    
    4. />  
    <Connector port="8080" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8" 
    />

    添加 address="0.0.0.0" ,修改后如下:
    Java代码 <Connector port="8080" maxHttpHeaderSize="8192" address="0.0.0.0"  
    1.                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  
    2.                enableLookups="false" redirectPort="8443" acceptCount="100"  
    3.                connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"    
    4. />  
    <Connector port="8080" maxHttpHeaderSize="8192" address="0.0.0.0"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8" 
    />


    此问题的根本原因是tomcat5.5启动时,如果检测到系统支持IPV6,那么默认监听的是IPV6地址的端口,导致通过IPV4无法访问。
    使用address="0.0.0.0"的意思是监听IPV4协议栈下的任意IP地址。
    IPV4协议监听任意地址应配置 0.0.0.0
    IPV6协议监听任意地址应配置 0:0:0:0:0:0:0:0
    据查,tomcat6之后此问题已不存在,默认监听的是IPV4地址端口。
  • 相关阅读:
    FreePascal
    Delphi
    FreePascal
    FreePascal
    Linux
    FreePascal
    FreePascal
    CodeTyphon
    IDEA
    工作流科普——don't ask i don't know either
  • 原文地址:https://www.cnblogs.com/xiejava/p/15171470.html
Copyright © 2020-2023  润新知