Rajan
Rajan

Reputation: 1511

Tomcat7 giving HTTP 404 ERROR while running the jsp file

I am having 404 error in the maven web-app project. I am using tomcat in the port 8081, enter image description here

The web.xml is as below;

<!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 xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"  
         version="2.5">

  <display-name>testProject</display-name>

  <servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
</web-app>

Do anybody have any Idea what might be wrong with the projects. I have other projects in my eclipse and they work. Also I tried to use jBoss but the error is same. I thing some kind of configuration is left out and I could not figure what.

Thank You in advance.

Upvotes: 0

Views: 820

Answers (2)

tonga
tonga

Reputation: 11981

Beside what Ralph suggested to check any possible build errors, you may also try moving your JSP page to src/main/webapp directory, and then in the project setting make sure that the web deployment assembly has the correct mapping. As an example, your src/main/webapp directory should be mapped to web context root / as shown the following example setting

Web deployment assembly

Upvotes: 1

Ralph
Ralph

Reputation: 120881

In your ScreenShot the red X on the project mean that eclipse found some error in your project. Often eclipse will not compile or deploy as long as there exist a serious error.

So fix the problem first, and then retry.

Upvotes: 2

Related Questions