• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Testing First Servlet....please help

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Gina Mein
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Gina
you can go through the following link.
http://www.moreservlets.com/Using-Tomcat-4.html
thanks
mary
 
I am a man of mystery. Mostly because of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic