Tomcat问题,不能正确访问http://localhost:8080/

最近在学Struts2框架部分的内容,但是eclipse中配置tomcat遇到了很大的问题,当辛辛苦苦的配置完了之后,竟让连小猫的首页都不能访问,http://localhost:8080/输入了之后提示HTTP Status 404

type Status report

message /sOffice2/

description The requested resource  is not available.

  于是乎,心酸的查找bug开始了,

(1)首先xxx.jsp文件必须放在WebContent目录下面,而不能放在WEB_INF目录之下

(2)第二个问题是在Stack overflow上面找到了答案:

1:Click on Window > Show view > Server or right click on the server in "Servers" view, select "Properties".
2:In the "General" panel, click on the "Switch Location" button.
3:The "Location: [workspace metadata]" should replace by something else.
4:Open the Overview screen for the server by double clicking it.In the Server locations tab , select "Use Tomcat location".(此时有可能界面为灰色)
5:Save the configurations and restart the Server.

方法里面说将tomcat换成自己的安装的tomcat,但是界面是灰色的,怎么办呢?原来是因为我们将项目部署到了tomcat上面,因此需要移除项目,在项目上面右击——Remove

此时Server locations界面即可用,"Deploy Path"后面的值默认是"wtpwebapps",把它改成"webapps",(这里面改成webapps也就是找到自己安装tomcat的目录,只不过换了名字之后软件可以自己定位到目录)

到此,问题就搞定了,入托上面两个方法我全部都没有用。

(3)即使eclipse中的tomcat服务器打开了,也没有,必须把外部的tomcat服务器打开。

c

 

posted @ 2016-11-01 12:58  SnailsCoffee  阅读(5887)  评论(0编辑  收藏  举报