• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot run servlet

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I write a servlet class and run it in my directory /WEB-INF/classes of "myapp", but tomcat shows The requested resource /myapp/servlet/HelloWorldServlet is not available.
After I put the servlet into another directory /WEB-INF/classes of "examples", it works.
Could anyone tell me how can I solve it ?
Thanks in advance!
Jack
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jack,
I think it because the context root is still set to the examples folder so change the context root to point to your folder in the web.xml.
Thanks
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to run a servlet using the "/servlet/" syntax, as in:
/myapp/servlet/HelloWorldServlet
Tomcat has to have the "invoker" servlet turned on - look in the web.xml for the examples to see how it is done.
Prior to the current version, "invoker" was on by default, but now it is off by default (except in the examples) which is why it did not work in /myapp/
The whole idea with "invoker" was to make it easy for beginners to get started without getting involved with web.xml settings but I think it has caused more harm than good.
Download the full servlet API from java.sun.com to get the straight info on configuring web.xml.
Bill
[ May 18, 2003: Message edited by: William Brogden ]
 
I'm still in control here. LOOK at this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic