Reputation: 43
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/
I am getting the following error: 404 error
I have confirmed my index.jsp is not in the WEB-INF folder: project files
JSP is located in webapp folder:
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
My 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>
My 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>
I have gone through the steps several times. The Tomcat server is started with no console errors. There are no problems/warnings.
Upvotes: 0
Views: 4662
Reputation: 3549
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:
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.
Go to deployment assembly, select java build.. and add maven dependencies.
Upvotes: 0
Reputation: 43
I ended up fixing this myself.
I deleted the web.xml and recreated it by right clicking on the project name in Project Explorer -> Java EE Tools -? Generate Deployment Descriptor Stub
This changed the folder structure. The web.xml is no longer under src > webapp. instead it is under WebContent.
I moved the index.jsp to be under WebContent (not in the WEB-INF folder).
Upvotes: 0