I installed tomcat 7.0.39 in ubuntu and tomcat seems to be running fine but it's giving me a 404 error everytime I am trying to run a deployed application.I was following the examples from Head First Servlets and JSP and I wrote the servlet example given in Chapter 1.I checked with the tomcat logs and everything seems to be alright but still the problem persists.I have downloaded and extracted tomcat under /usr/share/ directory and set the JAVA_HOME and CATALINA_HOME to java and tomcat directory respectively set under /etc/environment/
I tried running from eclipse but still the problem remains the same.
404 means Tomcat does not find a servlet to match your URL.
Most common causes are:
1. failure to put the servlet Java code in a package - Tomcat not able to find the class file if you didn't use a package.
2. failure to correctly set up the web app directories
3. especially to configure the web.xml deployment descriptor.
Thanks for the early reply ..I checked the deployment descriptor,looked fine to me ..tomcat application manager displayed the deployed apps and mine was listed.Tried to run it from there but still faced the same problem.I used netstat to check for any other applications which might be using the same port number as tomcat.There was none,but I still went ahead and changed the port values and tried and it started working.Anyway now its running but still couldn't figure it out what really caused the problem.
Joined: Apr 19, 2013
Add a index.jsp or index.html to your app, at least you have to be able to see a welcome file if the app is correctly deployed.
Then you could sort out why the servlet is not responding to the url you invoke, probably is a misspelling of the url or in the web.xml descriptor.