*
The moose likes Tomcat and the fly likes Testing First Servlet....please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Testing First Servlet....please help" Watch "Testing First Servlet....please help" New topic
Author

Testing First Servlet....please help

Gina Mein
Greenhorn

Joined: May 08, 2002
Posts: 6
Hello
I am trying to test my very first servlet on Tomcat 4. I am following the instructions written in the book 'More Servlets and JSP' by Marty Hall.
I compiled the 'HelloServlet.java' file . Now I am supposed to move this file in a location
"install_dir/webapps/ROOT/WEB-INF/classes"
My problem is that there is no "classes" directory under WEB-INF , so where should I put the 'HelloServlet.class' file?
I am a novice in Servlets...so please help....
Thanks
taash mg
Ranch Hand

Joined: Mar 22, 2002
Posts: 106
hi Gina

According to what i understand u should make a directory "classes" under ur webapps/ROOT/WEB-INF/ called classes and then put ur files in that directory. Try it out
Cheers
Taash
SCJP2


Cheers<p>Taash<br />SCJP2
Gina Mein
Greenhorn

Joined: May 08, 2002
Posts: 6
Thanks taash.
I created the 'classes' directory under web-inf and placed 'HelloServlet.class' there.
Now when I try to access 'http://localhost:8080/servlet/HelloServlet
it gives me the following error:
Apache Tomcat/4.0.3 - HTTP Status 404 - /servlet/HelloServlet
type Status report
message /servlet/HelloServlet
description The requested resource (/servlet/HelloServlet) is not available.
What should I do to run the servlet? Please Help...
taash mg
Ranch Hand

Joined: Mar 22, 2002
Posts: 106
HI Gina,
i had the same problems earlier but then i realised i was putting my files in the wrong directory. When u have have installed Tomcat it makes 2 directories on ur disk. one is Apache-tomcat 4.0... and the other is jakarta-tomcat-4.0.3 whatever.. u have to make ur classes folder in the webapps of the jakarta folder and then try
i hope u have done that
Cheers
Taash
Gina Mein
Greenhorn

Joined: May 08, 2002
Posts: 6
Hi!Taash,
I have installed Tomcat 4.0.3, which is the latest version available. It created only one directory i.e. jakarta-tomcat-4.0.
I renamed the above folder to tomcat4 and have put my class file in c:\tomcat4\webapps\Root\Web-inf\classes.
But the servlet does not work. Can you shed any light on how to make this work?
Thanks.
Gina
taash mg
Ranch Hand

Joined: Mar 22, 2002
Posts: 106
hi Gina,
yeah it creates only one directory-Apache-Tomcat-4. u r right.
Secondly have u put the servlet.jar in the classpath . try doing that. i am also new to tomcat but hope this helps
Cheers
Taash
mary nathan
Greenhorn

Joined: May 10, 2002
Posts: 16
hi Gina
you can go through the following link.
http://www.moreservlets.com/Using-Tomcat-4.html
thanks
mary
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing First Servlet....please help
 
Similar Threads
Doubt in servlet
Start In Servlets
Having trouble getting Tomcat up and running
Error: Requested resourse() not available
new errors!