I am doing a test for servlet in using Tomcat4.0.1. What I did is put a HelloServlet.class file into the following directory, <tomcat home>webapps\ROOT\WEB-INF\Classes\, then invoke the servlet: http://localhost:8080/servlet/HelloServlet. Based on the tutorial, this processedure should be right. But I failed to invoke HelloServlet.class. But if I put the class file into: <tomcat home>\classes\, I can get correct response from the servlet. Do you know the reason?
If you really did name the class directory "Classes", that could be the problem. Java very frequently requires upper/lower case distinctions be maintained in filenames even in OS's like Windows that otherwise don't care. The proper name of the directory is "classes" (all lower-case), and for certain any other capitalization will break the "write-once/run-anywhere" capabilities of the web app, since Unix system filenames ARE case senstive. It doesn't help any that when you create a folder with the Windows GUI, it very helpfully wants to uppercase the first character.
An IDE is no substitute for an Intelligent Developer.
Joined: Jan 28, 2002
Folks, I solved the problem! I downloaded a zip file then unzip it into my c:\ directory instead of downloading a exe file then install it. This is interesting issue, might be a bug in Tomcat4.0 distribution. After installation, I created /classes directory under /webapps/ROOT/WEB-INF, then put .class file into it, it works. Tim Holloway: You are right, it cannot be /Classes, it should be /classes.