tomcat 127.0.0.1 不能访问,但是用咯calhost可以访问
来源:互联网 发布:火力少年王软件下载 编辑:程序博客网 时间:2024/06/06 06:52
今天玩tomcat的时候,忽然发现了一个非常见的问题,写个日志记录下来。
tomcat版本: 5.5.33
服务端口: 8085
运行tomcat_home\bin\startup.bat 文件来启动tomcat.
启动正常,开始登陆tomcat。
在浏览器的地址栏输入:
http://127.0.0.1:8085 和 http://192.168.6.84:8085 , 浏览器返回“无法打开该页面”。
输入 http://localhost:8085 和 http://james-notebook:8085 却可以打开tomcat的页面。
难道 127.0.0.1 和 localhost不同? 难道我的网卡有问题?
-------------------------------------------------------------------------------------------------
网上找了一个相似的问题:"127.0.0.1可以访问tomcat,但localhost缺无法访问。"
这种问题的解决方案是:
进入C:\WINDOWS\system32\drivers\etc目录下,
查看hosts 文件中是否含有"127.0.0.1 localhost”, (注意:127.0.0.1前面不要有任何东西,特别是#号).
-------------------------------------------------------------------------------------------------
上面那种问题只要确保hosts文件中的配置正确就可以解决。
但是我这次发现的问题和上面的刚好相反:localhost可以访问tomcat,127.0.0.1访问不到!
127.0.0.1是网络中的回环地址,localhost只是本地主机地址。一般情况下两者是相同的。
localhost可以访问tomcat,127.0.0.1不能访问,难带是127.0.0.1出问题了?
我在命令行中分别ping 127.0.0.1 和 localhost 显示效果如下:
C:\Documents and Settings\Administrator>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
......
C:\Documents and Settings\Administrator>ping localhost
Pinging PC-201005210950 [::1] with 32 bytes of data:
Reply from ::1: time<1ms
......
发现了个问题:
在ping localhost时正常应该返回的是127.0.0.1,结果返回的却是 " ::1" 。
" ::1 " 这种写法是IPv6中的ip地址格式,相当于IPv4中的127.0.0.1 。
刚才我用http://127.0.0.1:8085 访问不到tomcat,然后我用 http://[::1]:8085 发现可以成功地访问到tomcat了。 至此源码天空,我怀疑导致不能用ip访问tomcat的问题是因为IPv6原因。
我打开网卡属性,发现其中安装了"Microsoft TCP/IP 版本 6"。
卸载掉IPv6,就可以使用IP访问tomcat了。
tomcat版本: 5.5.33
服务端口: 8085
运行tomcat_home\bin\startup.bat 文件来启动tomcat.
启动正常,开始登陆tomcat。
在浏览器的地址栏输入:
http://127.0.0.1:8085 和 http://192.168.6.84:8085 , 浏览器返回“无法打开该页面”。
输入 http://localhost:8085 和 http://james-notebook:8085 却可以打开tomcat的页面。
难道 127.0.0.1 和 localhost不同? 难道我的网卡有问题?
-------------------------------------------------------------------------------------------------
网上找了一个相似的问题:"127.0.0.1可以访问tomcat,但localhost缺无法访问。"
这种问题的解决方案是:
进入C:\WINDOWS\system32\drivers\etc目录下,
查看hosts 文件中是否含有"127.0.0.1 localhost”, (注意:127.0.0.1前面不要有任何东西,特别是#号).
-------------------------------------------------------------------------------------------------
上面那种问题只要确保hosts文件中的配置正确就可以解决。
但是我这次发现的问题和上面的刚好相反:localhost可以访问tomcat,127.0.0.1访问不到!
127.0.0.1是网络中的回环地址,localhost只是本地主机地址。一般情况下两者是相同的。
localhost可以访问tomcat,127.0.0.1不能访问,难带是127.0.0.1出问题了?
我在命令行中分别ping 127.0.0.1 和 localhost 显示效果如下:
C:\Documents and Settings\Administrator>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
......
C:\Documents and Settings\Administrator>ping localhost
Pinging PC-201005210950 [::1] with 32 bytes of data:
Reply from ::1: time<1ms
......
发现了个问题:
在ping localhost时正常应该返回的是127.0.0.1,结果返回的却是 " ::1" 。
" ::1 " 这种写法是IPv6中的ip地址格式,相当于IPv4中的127.0.0.1 。
刚才我用http://127.0.0.1:8085 访问不到tomcat,然后我用 http://[::1]:8085 发现可以成功地访问到tomcat了。 至此源码天空,我怀疑导致不能用ip访问tomcat的问题是因为IPv6原因。
我打开网卡属性,发现其中安装了"Microsoft TCP/IP 版本 6"。
卸载掉IPv6,就可以使用IP访问tomcat了。
- tomcat 127.0.0.1 不能访问,但是用咯calhost可以访问
- 本机ip不能访问本地tomcat服务,但是127.0.0.1就可以访问
- Tomcat 可以127.0.0.1访问,但不能localhost访问
- 不能打开localhost 但是能打开127.0.0.1 ; 可以访问127.0.0.1,不能访问localhost
- localhost不能访问,127.0.0.1可以访问
- webservice可以访问但是不能调用方法
- Tomcat 可以localhost访问,但不能127.0.0.1访问(转)
- Tomcat通过ip不能访问,但localhost和127.0.0.1可以访问
- Tomcat 可以localhost访问,但不能127.0.0.1访问(转)
- Apache 使用localhost(127.0.01)可以访问 但是使用本机IP(局域网)不能访问
- Tomcat在局域网中localhost可以访问,但是无法通过本地ip访问,127.0.0.1也无法访问问题的解决方法
- tomcat启动 项目可以访问 但是 tomcat界面无法访问 解决办法
- 【tomcat】eclipse配置好tomcat但是不能访问主页
- IE:localhost不能访问,127.0.0.1可以访问 问题
- 安装wamp后,127.0.0.1可以访问,localhost不能访问
- 127.0.0.1可以访问,localhost不能访问的问题
- Windows连Samba可以但是不能访问子文件夹
- nginx在服务器可以通过域名可以访问,但是在外网不能访问
- 区分指针数组的好方法
- Net share 命令详解小结
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- 文件格式介绍
- 如何使用 CocoStudio UI 编辑器实现《乱斗堂》设置界面
- tomcat 127.0.0.1 不能访问,但是用咯calhost可以访问
- XCode 5 Choose a destination with a supported architecture in order to run on this device. 不能启动APP
- 用 Quartz 进行作业调度
- Codeforces Round 206 DIV 2
- ElasticSearch测试小例子
- XML解析技术研究
- 北京地名由来
- 移动开发小结
- iPhone UITableView(利用UITableView实现平滑的九宫格效果)