tomcat能够正常启动,但是用http://localhost:8080打不开首页,用http://127.0.0.1:8080却能够打开……

解决方案 »

  1.   

    这个在自己机器上运行不可能出现的楼主,,只有可能楼主这两个地方一些小细节书写有误,localhost与ip地址是等价的,楼主重启服务器,再试试,不会有问题的。
      

  2.   

    localhost:8080,你这里的:不会是中文的吧?
      

  3.   

    计算机之所以能解析localhost对应于127.0.0.1是因为默认在HOST文件中进行键值对配置。楼主看看HOST文件中是不是没有这个配置。
      

  4.   

    查看host文件中localhost是否对应127.0.0.1,
      

  5.   

    hosts文件看看是不是正确。
    还有就是2楼说的,不会是中文的冒号吧?
      

  6.   

    可能文件出现在HOST文件中不是127.0.0.1
      

  7.   

    可能原因是HOST文件中不是127.0.0.1
      

  8.   

    http://localhost:8080跟http://localhost:8080不一样喔.
    不要全角的:
      

  9.   

    C:\Windows\System32\drivers\etclocalhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
            ::1             localhost
      

  10.   

    这个问题我遇到过 楼主其实我猜测你公司是用代理服务器上网的所以你应该把代理服务器里面 选中代理服务器下面那项 跳过本地地址服务器 选上这样的话你的代理服务器就在java中被跳过了也就能显示出来Localhost那个地址了
      

  11.   

    看看你本机的HOST文件(位置在C:\WINDOWS\SYSTEM32\DRIVERS\ETC\),里面定义的localhost是127.0.0.1么?
      

  12.   

    在你的系统盘中
    windows-->system32-->drivers-->etc
    在该文件夹下查找HOSTS文件,用记事本打开
    # Copyright (c) 1993-1999 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host127.0.0.1       localhost如果是这样说明你是可以用localho访问的
    因为localhost的命名是在这里配置的。
    如果不可以的话.在tomcat的server.xml文件中查看
    <Engine name="Catalina" defaultHost="localhost">
    <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">        <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->        <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
                   prefix="localhost_access_log." suffix=".txt" pattern="common"   resolveHosts="false"/>
            -->      </Host>
      

  13.   

    我只出现过8080打不开,然后在conf文件夹的sever.xml把8080端口改一个就可以了。
      

  14.   

    多谢各位了……是我的host文件里面少了一句127.0.0.1 localhost。真的很感谢大家了……