File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes HTTP Status 404 error in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTTP Status 404 error in tomcat" Watch "HTTP Status 404 error in tomcat" New topic
Author

HTTP Status 404 error in tomcat

Jayavardhan Ncbr
Greenhorn

Joined: Jul 25, 2011
Posts: 9
Hi,
Check whether your tomcat service is running or not in services.msc
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
Well this problem is resolved. My tomcat server was running properly even i was getting 404 error. The reason behind this is the missing file like index.jsp which was not compied properly into my eclipse working directory. After coping ROOt folder from tomcat to eclipse .metadat folder the error is gone.

I have copied following text from website http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html which is quite helpful.

Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to C:\apache-tomcat-7.0.8\webapps, R-click on the ROOT folder and copy it. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". You should find something like your-eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps (or .../tmp1/wtpwebapps if you already had another server registered in Eclipse). Go to the wtpwebapps folder, R-click, and paste ROOT (say "yes" if asked if you want to merge/replace folders/files). Then reload http://localhost/ to see the Tomcat welcome page.


Now iam facing otherproblem with Axis2 which is not dispalying my service and giving error : cannot be cast to org.apache.axis2.deployment.DeploymentClassLoader
Any help?
Praful Chandekar
Greenhorn

Joined: Jun 01, 2011
Posts: 8
@Maria Anjum
Which OS are you using?
Because I got Error in Windows 7 but not in Windows XP
Emmanuel Waûters
Ranch Hand

Joined: Jul 16, 2009
Posts: 33
Hallo,

I had resolved my problem. When using Eclise Helios and Tomcat 6 or 7 You have to do the next:
“Copy the ROOT (Default) Web App into Eclipse.
Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to C:\apache-tomcat-7.0.8\webapps, R-click on the ROOT folder and copy it. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". You should find something like your-eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps (or .../tmp1/wtpwebapps if you already had another server registered in Eclipse). Go to the wtpwebapps folder, R-click, and paste ROOT (say "yes" if asked if you want to merge/replace folders/files). Then reload http://localhost/ to see the Tomcat welcome page.”
Source : http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html
When updating the the used and to be used jar-files my application worked ok. But now when using Eclipse Indigo and Tomcat 6 or 7 on my new computer I get – when typing localhost:8080 after starting Tomcat in the Eclipse IDE- the Tomcat homepage. But when running my application http://localhost:8080/cew/login.faces I got the Tomcat error page http 404 the resource could not be found. My opinion is that it had to do something with the Tomcat configuration, more specifically the place where the war-file and project map are to be found, although mine are found in de webapps file – the cew war-file and the project map cew with all the files-. There are no project errors –it is the same webapplication that runned on my old computer with Eclipse Helios and Tomcat 7. But now it won’t work. Even more when I installed Eclipse Helios and Tomcat 7 and I got also again the HTTP 404 error of Tomcat. I don’t undertand it any more.

Emmanuel
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
Well, I am using winXP and vista and this worked with both.
The problem is files remain missing in working folders and these errors appear. Error 404 doesnt mean that your tomcat is not working it only shows that it is unable to find index files. It also depends on the status of the server in eclipse either started or not. I am using tomcat in Eclipse.


Now my problem - i didnt get services working on Axis- i am running it in eclipse.
snehansh konda
Greenhorn

Joined: Aug 20, 2011
Posts: 2

Hi I am a Servlets and JSP newbie and I am getting a similar error. I am doing the sample program (Chapter 3) in HFSJ 2nd edition but I am using Java 6 and Tomcat 7 for learning JEE 6. I was able to complete the first two versions of the app but I am getting the error when I am trying to run the app using JSP.
The error is as given below:

type Status report

message /Beer-v1/result.jsp

description The requested resource (/Beer-v1/result.jsp) is not available.

This app is running when I replace the "result.jsp" as given in the book with a "hello.jsp" given in one of the examples provided in TOMCAT.
The environment variables set in my system are JAVA_HOME, CATALINA_HOME.
I have set the java path as well in CLASSPATH and PATH.
Also, I am typing the JSP code in notepad and saving it. Not using any editor till now.

Just to summarize my Tomcat page is opening normally after startup but when I try to redirect a servlet to a JSP I get the error that the JSP file is not available. When I replace this JSP with another one provided in the Example given by TOMCAT the entire app seems to work properly.

I have seen the previous posts and followed the steps accordingly but I am still getting the error.

Please suggest what steps are to be taken to solve this problem.


Regards,
Snehansh
snehansh konda
Greenhorn

Joined: Aug 20, 2011
Posts: 2

snehansh konda wrote:Hi I am a Servlets and JSP newbie and I am getting a similar error. I am doing the sample program (Chapter 3) in HFSJ 2nd edition but I am using Java 6 and Tomcat 7 for learning JEE 6. I was able to complete the first two versions of the app but I am getting the error when I am trying to run the app using JSP.
The error is as given below:

type Status report

message /Beer-v1/result.jsp

description The requested resource (/Beer-v1/result.jsp) is not available.

This app is running when I replace the "result.jsp" as given in the book with a "hello.jsp" given in one of the examples provided in TOMCAT.
The environment variables set in my system are JAVA_HOME, CATALINA_HOME.
I have set the java path as well in CLASSPATH and PATH.
Also, I am typing the JSP code in notepad and saving it. Not using any editor till now.

Just to summarize my Tomcat page is opening normally after startup but when I try to redirect a servlet to a JSP I get the error that the JSP file is not available. When I replace this JSP with another one provided in the Example given by TOMCAT the entire app seems to work properly.

I have seen the previous posts and followed the steps accordingly but I am still getting the error.

Please suggest what steps are to be taken to solve this problem.


Hi, this problem is solved. Quite a silly reason actually. I didnt save the JSP file in the category of 'ALL FILES' while saving the file from notepad. Changing that solved the problem
Maona Mustermann
Greenhorn

Joined: Oct 06, 2011
Posts: 1
Well... just to add some things to avoid the error.

As i started my programm in eclipse on my windows pc, it was working fine, but when i uploaded it on my virtual server with arch linux i got the 404 error.

So first of all make sure your Programm directory has the proper privileges. After this i saw my Programm in the Manager Tool... started, but still gave me the 404 finger.

my last error i found to make it work was the directory:

Wrong:
--exampleApp
----WebContent
------WebInf
--------web.xml
--------classes
----------dirToMyPackage
----------app.class

right:
--exampleApp
----WebInf
------web.xml
--------classes
----------dirToMyPackage
----------app.class

took me quite some time

hope i can hel sb

regards


PS: content of the hello world example i used can be found here
Vimal Kumar Venugopal
Ranch Hand

Joined: Aug 20, 2011
Posts: 43

Hi Varun and Lakshmi,

You have mentioned in your reply that because of your mistake, the 404 error was resolved. Could please share with me in detail what was the mistake and how it got resolved?

I am also getting the same error on and off. I really dont know what to do. Do we have to restart Tomcat whenever we change faces-config.xml or web.xml?
Please help me.


"Value has a Value only if its value is valued!"
manoj patelia
Greenhorn

Joined: Dec 28, 2011
Posts: 1

Hi,

I am also getting the same 404 resource not found error but in my case tomcat homepage is showing
jeff rosenberg
Greenhorn

Joined: Feb 01, 2012
Posts: 1
Did you build the project? I was having the EXACT same problem and when I built the project it ran. I feel like a bit of an idiot for it



I made an account just for this.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Welcome to the Ranch!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Owee Nicolas
Ranch Hand

Joined: Jun 16, 2002
Posts: 49
Very helpful. Thanks!


Owee<br />SCJP 1.4
Swetha Bhagavathula
Ranch Hand

Joined: Jan 04, 2011
Posts: 112



Sorry all.I think its too late to reply but hope it is useful.

use <welcome-file-list> tag in web.xml if you get 404 error.. if you are using IDE:

type the following:according to your web resource program:please make note of it

in web.xml:


hope this works fine.
because by default if you are using DE index.jsp is set as start up or home page sometimes even because of WAR file generation of you web application you can face such 404 status code error pages.so you either set your Servlet program name or your Html based on your requirement..Run your application.see that your deployment directory structure is perfect.:

see the attachement .Hope that may work fine


[Thumbnail for Deployment Directory Structure of a web application .jpg]



SCJP5
syed yousuff
Greenhorn

Joined: May 26, 2012
Posts: 4
Hi Friends ,Is it a must to set the environment variables for j2ee, Since i am getting the same error as 404
Swetha Bhagavathula
Ranch Hand

Joined: Jan 04, 2011
Posts: 112

unless and until you place the servlet-api.jar(for tomcat) the container will not recognise your web application, can you please be more precise .. setting environment variables depends upon the software you are using.. but almost for all evn for framework software like struts etc we need to set path..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

You shouldn't do anything with servlet-api.jar. The container provides the version you need, and providing your own copy will very likely break your application and perhaps even your entire container (if placed in the wrong place).
shruti basu
Greenhorn

Joined: Aug 30, 2006
Posts: 3
Not sure whether this is too late to post.
In Tomcat ,you might get 404 error for your jsp file if it is inside WEB-INF directory and in web.xml you have not mentioned file path from WEB-INF.
Like in web.xml it should be written as :
<welcome-file>/WEB-INF/index.jsp</welcome-file>

This is a security reason.
Hope it helps.

-Shruti
nagi ponnaganti
Greenhorn

Joined: Nov 22, 2009
Posts: 4
It could happen if the <welcome-file-list> you have mentioned in the web.xml is not in the right location. so please make sure your resource exist first
Dipankar Pal
Greenhorn

Joined: Feb 19, 2013
Posts: 2
Make sure you have a right resource under your war file.
It might happen index.html does not exist under war file.Create a index.html and put some text inside body tag and run. it will work.
Dipankar Pal
Greenhorn

Joined: Feb 19, 2013
Posts: 2
Your web.xml file is the culprit.
In web.xml under <welcome-file-list> tag you should have a right resource. By default it will have index.html and all.To test you can create a dummy index.html and test it.
David Hildebrandt
Greenhorn

Joined: Feb 28, 2013
Posts: 2
When using an Eclipse IDE (I am using JBoss Developer Studio 6.0.0.GA), I had the same problem with the HTTP 404. I could run Tomcat 7 from the command line and see the Tomcat page at localhost:8080, but using the IDE to start Tomcat I could not. Rather, when starting Tomcat using the IDE I got the HTTP 404.

The solution was in setting the 'Server Location' of Tomcat within the IDE, as described here:

http://stackoverflow.com/questions/2280064/tomcat-started-in-eclipse-but-unable-to-connect-to-link-to-http-localhost8085
David Hildebrandt
Greenhorn

Joined: Feb 28, 2013
Posts: 2
.
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

hi David Hildebrandt ,

Yes you are absolutely right . This is the main reason why we dont get to see the homepage of tomcat when run from withing eclipse IDE. Another thing I would like to add here is that , if you use eclipse to start your server and use the default server location ( from context of eclipse , NOT from tomcat directory ) then eclipse makes use of another directory to deploy applications with the name of "wtpwebapps" instead of the default "webapps". If you go to this directory ( it will be at $CATALINA_HOME$/wtpwebapps and it will only appear if you start the server atleast once from the IDE and use the default server location of eclipse ) , you will notice that only the ROOT is there and no other files ( welcome files ). This is why , when run from within eclipse, we get a 404 not found page on the URL http://localhost:<port>;


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Aarpriase Sharma
Greenhorn

Joined: Mar 19, 2013
Posts: 1
I am sure that lot of people faced this error and everyone had some or the other mistake. I will share my mistake. Name of my web.xml was Web.xml ( W in caps ) and hence i was getting the 404 error. All the best.
Sachin Kumar R Gundi
Greenhorn

Joined: Sep 20, 2011
Posts: 4

Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace.This can be fixed in eclipse by following the below steps.
1. Go to Java perspective
2. Select Window->Show View->Server
3. Double click the added tomcat server and Overview Screen is displayed.
4. Under Server Locations select 2nd radio button (Use Tomcat installation) and save it and restart the server.

Happy coding!!!
Sachin Kumar R Gundi
Greenhorn

Joined: Sep 20, 2011
Posts: 4

Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace.This can be fixed in eclipse by following the below steps.
1. Go to Java perspective
2. Select Window->Show View->Server
3. Double click the added tomcat server and Overview Screen is displayed.
4. Under Server Locations select 2nd radio button (Use Tomcat installation) and save it and restart the server.

Happy coding!!!
Hoang Tuan
Greenhorn

Joined: May 01, 2013
Posts: 1
I do this and issue resolved !!


waleed abdullah
Greenhorn

Joined: May 14, 2013
Posts: 1
hi
please help i am working with tomcat 7 but when i run my app i got HTTP Status 404 error
HTTP Status 404 - /Money transfer/

type Status report

message /MYAPP/

description The requested resource (/money transfer/) is not available.
i got same error with any other app run on tomcat what should i do i have been googling but still not succeded please help
this is my 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"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
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>Struts 2</display-name>
<welcome-file-list>
<welcome-file>test.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>"*.htm"</url-pattern>
</filter-mapping>
</web-app>
sashwat kumar padhy
Greenhorn

Joined: Jun 12, 2013
Posts: 20

->Click on servers
->Tomcat server will be displayed,Now right click there and goto properties
->General->Location->click on the switch location button
->Next on the left hand side panel,click on servers
->Except Tomcat v7.0 Server at localhost-config there will be another server like Tomcat v7.0 Server at localhost.server,Double click on it
->Under server locations select the 2nd radio button i.e use tomcat installation
->Now save this and you are good to go
->RESTART THE SERVER

Hopefully this helps!
Biswo Pattanaik
Greenhorn

Joined: Jun 25, 2013
Posts: 1
Hi Techies,
I have also the same 404 page note found issue.I am able to resolved the issue.

Issue:-404 Page note found error in apache-tomcat-6.0.29

1)Update the apache-tomcat-6.0.29\conf\contex.xml with

<Context antiResourceLocking="false" privileged="true" useHttpOnly="true">

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1"/>

add the above lines to the file.Don't remove any existing lines.

2)Update the apache-tomcat-6.0.29\conf\tomcat-users.xml with

<role rolename="manager"/>
<user username="userusername" password="password" roles="manager"/>

3).Using command prompt try to start the tomcat
apache-tomcat-6.0.29\bin\startup.bat

4)http://127.0.0.1:8090/manager/html

Hope it will resolve your 404 issue.

Ronnie She
Greenhorn

Joined: Oct 16, 2013
Posts: 1
This is very useful, you may refer to this link

http://www.youtube.com/watch?v=r1Fc7PuOtT4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 error in tomcat
 
Similar Threads
Tomcat manager problems
Hello World
problem with servlets
What can cause a .war file not to show/load?
"HTTP Status 404" with Tomcat