HTTP状态404尽管tomcat正在运行并且jsp可用,但请求的资源不可用错误. [英] HTTP Status 404 The requested resource is not available error despite tomcat running and jsp available?
问题描述
我正在运行以下教程: crunchify.com/how-to-to-create-dynamic-web-project-using-maven-in-eclipse/
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/
我收到以下错误: 404错误
我已经确认我的index.jsp不在WEB-INF文件夹中: 项目文件
I have confirmed my index.jsp is not in the WEB-INF folder: project files
JSP位于webapp文件夹中:
JSP is located in webapp folder:
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.crunchify</groupId>
<artifactId>CrunchifyMavenTutorial</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>CrunchifyMavenTutorial Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<build>
<finalName>CrunchifyMavenTutorial</finalName>
</build>
</project>
我的web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
我已经完成了几次步骤. Tomcat服务器启动时没有控制台错误.没有问题/警告.
I have gone through the steps several times. The Tomcat server is started with no console errors. There are no problems/warnings.
推荐答案
在eclipse中设置tomcat并尝试运行简单的hello world应用程序时,您会遇到很多此错误.您可以按照以下给定步骤进行操作:
When you are setting up tomcat in eclipse and trying to run simple hello world application, you face a lot this error. You can follow below given steps:
-
右键单击项目属性,然后转到项目构面,选择Web应用程序模块,然后在下方选择蓝色配置链接,然后选择目录src/main/webapp.
Right click on project properties, and go to project facet, select web application module, then select blue colour configuration link at the downside, and select content directory to src/main/webapp.
转到部署程序集,选择java build ..并添加maven依赖项.
Go to deployment assembly, select java build.. and add maven dependencies.
这篇关于HTTP状态404尽管tomcat正在运行并且jsp可用,但请求的资源不可用错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!