• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem running servlet in tomcat

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic