This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Eror 404  in accessing Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Eror 404  in accessing Servlet" Watch "Eror 404  in accessing Servlet" New topic

Eror 404 in accessing Servlet

Anil Jain
Ranch Hand

Joined: Mar 10, 2002
Posts: 51
Environment : Tomcat 3.3 , jdk 1.3
I have written one servlet "" and stored in the following directory structure
tomcat\webapps\myApp\WEB-Inf \classes\
When i try to access this servlet with url
I get message "404"
Please advise!!

Anil Jain<br />Sun Certified Java(2) Programmer
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
A servlet engine will NOT compile your servlet for you - it will only recognize a class file. The only compilation a servlet engine does automatically is for JSP files.
You will get better results if you put the TestingServlet in a package, in which case the location under WEB-INF/classes must reflect the package name. Study how the Tomcat examples are done.
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
404 is the File Not Found Error
Your server is trying to find a .class file...if you store the .java of course it wont work...
But if what you want is to get the .java file (who knows) then you should ask the browser for , not only TestingServlet
Anil Jain
Ranch Hand

Joined: Mar 10, 2002
Posts: 51
Hi William and Juanjo!
Thanks for replying my question. You guys were correct, my compiler was not generating .class file in the folder for some reason. I corrected it and now I am getting .class file.
My problem is solved. Thanks for the specific remedy.
I agree. Here's the link:
subject: Eror 404 in accessing Servlet
jQuery in Action, 3rd edition