Hi, I'm working through the Head First Servlets and JSP's (send ed.) book and I can't get the first servlet to work. Despite trying things I found in other threads on this forum for the same thing
I'm getting a 404 error when I go to the url http://localhost:8080/ch1/serv1
description The requested resource (/ch1/serv1) is not available.
Can anyone give me a pointer to what (undoubtedly stupid) mistake I'm making?
My system details:
OS: Ubuntu 10.0.4 (32 bit)
Tomcat Version: Apache Tomcat/6.0.24
JVM Version: 1.6.0_18-b18
JVM Vendor: Sun Microsystems Inc.
OS Name: Linux
OS Version: 2.6.32-24-generic
OS Architecture: i386
-C! -C! It's easier with the trailing "/" to show directories.
I would, however, like to commend you on the quantity and quality of information provided to help solve the problem.
Unfortunately, I'm not sure what the problem is, because everything appears to be in order. Is there anything in the log at startup or when you try to access the servlet from the browser? (And you're probably right, it'll end up being something silly, which will make *me* look even sillier for not seeing it :)
I agree. Everything seems to be in place and hence really difficult to predict what's going on wrong. So, thought of asking very basic (and bad) question. Have you started/restarted tomcat after the deployment? [tomcat doesn't support hot-deploy].
If you have restarted the tomcat, can you please study the log and let us know whether everything is fine there? No exceptions?
Joined: Sep 30, 2008
Yes, I restarted (if I hadn't, I'd take myself out back and shoot myself - as a mercy to the rest of the human race :-))
As for the logs .... de nada. Or I can't find them.
The only log in the web server showing changes is Catalina.out:
No mention of my app at all
Joined: Sep 30, 2008
It's fixed, and it's stupider than not restarting the app server
On Linux (well Ubuntu 10.0.4 anyway) you have 2 webapp directories /usr/share/tomcat6/webapps and /var/lib/tomcat6/webapps/
why? I don't know
I'd been using /usr/share/tomcat6/webapps. This is apparently the wrong one to use. I put my app into /var/lib/tomcat6/webapps, restarted and it worked
Thank you for the assistance, I'm afraid I now have to get a gun and drag myself out back, nice knowing you :-)
Hi Steven, in the beginning I also used to get the same errors. What I did in the beginning is, we wont get servlet.jar with jsdk, so I used to copy the jar into java/jre/lib to compile. Then later I used to take the class tile into WEB-INF/classes folder. Then later I realized that this is not the right approach, so you once check whether you have done something like this.