Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 error

 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam getting resource not found error.Though i knw what this error means etc, but in my case iam not able to resolve my issue.

This is my directory structure

C:\apache-tomcat-6.0.16\webapps\ch1\web-inf\classes

within web-inf i have put my web.xml file

and within classes i have put my compiled servlet class
ChServlet.class

I type the below URL in my browser :

http://localhost:8080/ch1/Serv

all seems correct but still i get below error

type Status report
message /ch1/Serv
description The requested resource (/ch1/Serv) is not available.




Web.xml file





Please help me resolve this
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Case counts. It's WEB-INF, not web-inf.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it was originally WEB-INF, but since it was not working , i changed it to web-inf....... I have changed it again to caps now....but still not resolved....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Random changes aren't likely to help.

Next: Sometimes, servlets in the default package work, sometimes they do not. The next thing to eliminate as a possible source of error is to put the servlet in a package other than the default.

Also, set up the Manager app and see if your web app is even running.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have gone through the other topic related to same error in this forum....
so i understood the way to set the manager application.......

if i simply write address http://localhost:8080/ch1/ .....still 404 error

I can run the application manager now. However i could not see /ch1 application there.Do i need to do something else?
I can only see / Welcome to Tomcat
/docs Tomcat documentation
/host-manager Tomcat Manager Application
/manager Tomcat Manager Application


above all are true as well. However i cannot see my /ch1 application.

Also there are no errors in 'TOMCAT_HOME/logs/*' folder....

I reiterate... my folder structure is like this

C:\apache-tomcat-6.0.16\webapps\ch1\WEB-INF

within WEB-INF, i have ---- web.xml
---- classes folder
---- lib folder( empty)


ChServlet.class is put in classes folder

Please help
[ September 08, 2008: Message edited by: Maan Shenoy ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can run the application manager now. However i could not see /ch1 application there.


Therefore we can conclude that Tomcat does not see a usable web application at this address. Log file messages on restarting Tomcat should reveal where it is going wrong.



Tch! The class file will not be found because it is not in a package.

Bill
[ September 08, 2008: Message edited by: William Brogden ]
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maan Shenoy:
ChServlet.class is put in classes folder


Have you tried to put the servlet class inside a package??

Have you restarted tomcat each time you have made changes??

Try to remove the 'ch1' folder from tomcat - and (re)start tomcat. When tomcat is running watch the console (if windows) or logs/catalina.out (if UNIX/Mac/Linux) - then drop the folder 'ch1' into webapps, and see if it is been deployed.

You can also try to put a plan HTML page in the root of the 'ch1' folder, and see if you can call it.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem got resolved ...thanks for all the inputs....the problem was with my path settings of tomcat....actually there were 2 tomcats installed on my machine....a really silly one....... but anyway my issue got resolved.....


thanks again....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic