日期:2014-05-20  浏览次数:20646 次

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

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

------解决方案--------------------
hosts文件看看是不是正确。
还有就是2楼说的,不会是中文的冒号吧?
------解决方案--------------------
可能文件出现在HOST文件中不是127.0.0.1
------解决方案--------------------
可能原因是HOST文件中不是127.0.0.1
------解决方案--------------------
应该是host文件的问题吧
------解决方案--------------------
http://localhost:8080跟http://localhost:8080不一样喔.
不要全角的:
------解决方案--------------------
C:\Windows\System32\drivers\etc

localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
------解决方案--------------------
上面的兄弟,应该说出了所有的可能原因。。LZ照着试试应该没问题咯
------解决方案--------------------
去server.xml里面自己看看吧
------解决方案--------------------
大家基本上说全了可能的原因,楼主重启电脑,在按上面的说法试试看。
------解决方案--------------------
这个问题我遇到过 楼主

其实我猜测你公司是用代理服务器上网的

所以你应该把代理服务器里面 选中代理服务器下面那项 跳过本地地址服务器 选上

这样的话你的代理服务器就在java中被跳过了

也就能显示出来Localhost那个地址了
------解决方案--------------------
看看你本机的HOST文件(位置在C:\WINDOWS\SYSTEM32\DRIVERS\ETC\),里面定义的localhost是127.0.0.1么?
------解决方案--------------------
在你的系统盘中
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 host

127.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"