• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem running servlet in tomcat

 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have included the servlet-name and servlet-class elements in web.xml. I have the HelloWorldServlet class file under webapps/chapt1/web-inf/classes directory.
When I try to run the servlet using http://localhost:8080/chapt1/servlet/HelloWorldServlet, I get the following error.
HTTP Status 404 - /chapt1/servlet/HelloWorldServlet
type Status report
message /chapt1/servlet/HelloWorldServlet
description The requested resource (/chapt1/servlet/HelloWorldServlet) is not available.

But if I include a servlet-mapping element in the web.xml and try to run the servlet using http://localhost:8080/chapt1/HelloWorldServlet, it works.
How can I run the servlet using http://localhost:8080/chapt1/servlet/HelloWorldServlet...How to resolve the above error.
Thanks.
[ June 19, 2003: Message edited by: Saraswathy Krishnamoorth ]
 
sultan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess you don't have any package inside your servlet so ignore /servlet and try hitting the HelloWorldServlet ...hope it should work
 
Louise Haydu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some later versions of TomCat have the invoker servlet mapping commented out in the conf\web.xml file. If this is your first attempt at running a servlet in TomCat, this may be your problem.
 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sultan and Louise Haydu.
I am using the Tomcat version 4.1.24 and the invoker servlet mapping was commented out in conf/web.xml. After uncommenting that, the url http://localhost:8080/chapt1/servlet/HelloWorldServlet... works.
Why is the invoker servlet mapping commented out in conf/web.xml in newer version of tomcat. Are we not suppose to use /servlet/HelloworlServlet....

Thanks.
[ June 20, 2003: Message edited by: Saraswathy Krishnamoorth ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic