Eclipse – Apache tomcat 7 No error with localhost page, But when run project: show HTTP Status 404

eclipsehttp-status-code-404localhosttomcat

I know there are many questions about Apache tomcat 404 error: but I think mine is different.

  • I am using windows 7 64 bit
  • unzipped eclipse-jee-juno-SR2-win32-x86_64 to C:\
  • unzipped apache-tomcat-7.0.37-windows-x64
  • changed port server.xml to 3030 instead of 8080
  • continue with this steps "Quick Start" from point (2)
  • I didn't forget:
  • copying ROOT folder
  • R-click tomcat node in eclipse Servers tab -> properties -> Switch location
  • Double click tomcat node in Project explorer and check use tomcat instillation (takes control of tomcat installation)

The page:http://localhost:3030/ works fine. It shows the message If you're seeing this, you've successfully installed Tomcat. Congratulations!

But when I tried simple project (I followed basic tutorial) and use Run as -> Run on Server the page of error 404 is shown. When back to http://localhost:3030/ it shows no error.

  • No error with http://localhost:3030/
  • Error when running a project!

HTTP Status 404 – /SimpleProject/


type Status report

message /SimpleProject/

description The requested resource is not available.


Apache Tomcat/7.0.37

Best Answer

I am The author of this question, and I solved it. I will provide the solution so that others can get help from it.

As I followed this installation steps carefully, then the installation is correct.

The only problem that caused the error is in the web.xml:
- When create a new "Dynamic Web Project" (As my case)
- Take care of this file: WebContent -> WEB-INF -> web.xml
- The <welcome-file> </welcome-file> tags must refer to exist files to display in the browser.
- If there are some default tags delete them.
- when you create for example a new HTML file named index.html, then make sure that the web.xml file refers to it. <welcome-file>index.html</welcome-file>


Digression (irrelevant to the solution above)
I am actually working on NetBeans extensively doing simple Java Standard Edition projects. I rarely encountered problems with NetBeans, and when they occur I can solve them easily either myself or by searching for information about the problem.

When I began learning the Java Entrprise Edition, and see tutorial on NetBeans, I started my first project from the first day.

But I found most of the tutorials use Eclipse and that was the reason why I installed it.

When I moved to Eclipse. I encountered many problems, and each problem take many hours to search and solve. that takes three days before starting one project.

I am wondering why people prefer Eclipse over NetBeans. I think there is some reason. (^_^)

Related Topic