Anyone try to put java classes file into Tomcat ever?
james
Greenhorn
Joined: Jan 28, 2002
Posts: 5
posted
0
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?
Learning is no limit!
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
This may be related the fact that if you don't put your servlet classes in a package, Tomcat looks in it's "current" directory.
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.
Customer surveys are for companies who didn't pay proper attention to begin with.
james
Greenhorn
Joined: Jan 28, 2002
Posts: 5
posted
0
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.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Anyone try to put java classes file into Tomcat ever?