• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

HTTP Status 404 error in tomcat

 
Greenhorn
Posts: 9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Check whether your tomcat service is running or not in services.msc
 
Greenhorn
Posts: 7
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Maria Anjum
Which OS are you using?
Because I got Error in Windows 7 but not in Windows XP
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
Oracle Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
snehansh konda
Greenhorn
Posts: 2
Oracle Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 43
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
Android Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am also getting the same 404 resource not found error but in my case tomcat homepage is showing
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very helpful. Thanks!
 
Ranch Hand
Posts: 112
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Deployment-Directory-Structure-of-a-web-application-.jpg
[Thumbnail for Deployment-Directory-Structure-of-a-web-application-.jpg]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 112
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.
 
Ranch Hand
Posts: 439
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>;
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 4
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do this and issue resolved !!


 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Greenhorn
Posts: 20
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
->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!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is very useful, you may refer to this link

http://www.youtube.com/watch?v=r1Fc7PuOtT4
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dont type any extension(.java/.jsp) in the url ........ else HTTP 404 error will occur
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic