【发布时间】:2014-01-03 04:30:11
【问题描述】:
我知道之前有人问过这个问题,但给出的任何答案都没有解决我的问题。
我在 Eclipse 中使用 JSP 创建了一个名为 JSP_web_application_01 的 Web 应用程序,并且我使用的是 ubuntu 12.04 LTS。我在 WebContent 目录中有 index.jsp 文件。我使用命令提示符制作了它的 .war 文件,为了部署它,我将它放在 tomcat 的 webapps 文件夹中,并使用命令 sudo $CATALINA_HOME/bin/shutdown.sh 停止 tomcat 并再次通过 sudo $CATALINA_HOME/ 启动它bin/startup.sh
它膨胀了 .war 文件(JSP_web_application_01.war)并创建了 JSP_web_application_01 文件夹结构和所有内容,但当我尝试使用以下方式从浏览器访问它时得到的是 http 404 状态代码:
http://localhost:8080/JSP_web_application_01/
我明白了:
HTTP Status 404 - /JSP_web_application_01/
type Status report
message /JSP_web_application_01/
description The requested resource is not available.
Apache Tomcat/7.0.47
这是我在 WebContent/WEB-INF 文件夹中的 web.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>JSP_web_application_01</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
这是我第一次尝试托管 Web 应用程序。因此,任何帮助将不胜感激。
【问题讨论】:
-
“我使用命令提示符制作了它的 .war 文件”是什么意思?