Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat servlet enabler

 
Ryan Wilson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded and installed Tomcat 4.1.
I'm unable to access links with /serlvet/HelloWorld
I get the servers 404 error.
I can access the servlets when using URL mappings.
Im new to Tomcat and not sure if there is something in Tomcat that needs to be set in order for this to work.
Im trying to run the samples form the Study Kit.
Any help would be great
 
Amer Khan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this link.
http://www.coderanch.com/t/166743/java-Web-Component-SCWCD/certification/small-web-application
[ August 22, 2003: Message edited by: Amer Khan ]
 
Ryan Wilson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That link did contain some great information, however it did not explain how to configure Tomcat to use a path with /servlet/servletname.
 
Milena Khlabystova
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ryan!
The servlet responsible for invoking other servlets by their fully qualified class names via "/servlet/ServletClass" URL is called the "invoker" servlet and is declared in the container-wide web.xml file located in "your-tomcat-install-dir"/conf/ directory.
To be able to access your servlets via this mechanism, the following entry must be present and uncommented in this container-wide web.xml file on your machine:
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
It's probably present but it may be commented out. However, if it is not there, it should be added to the section that contains all other <servlet-mapping> entries. Remember: the order of elements in web.xml file is important.
Hope this helps.
Milena
 
Ryan Wilson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milena thanks for your help.
I'm now able to run the samples.
I wonder why the servlet mapping was commented out?
anyway Thanks again
 
Joe Pluta
Ranch Hand
Posts: 1376
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the idea is that the invoker servlet is primarily for debugging an application - it's used when the names of the servlets you will be using are subject to change, and so you can't create the mappings.
However, once a product is ready to go to production, you should explicitly map all servlets; that simply means you have your application well defined and not only that it provides a little extra modicum of security.
Me, I don't know that I agree with this particular argument, and I usually enable invoker and leave it enabled. It makes it very easy for me to send a test servlet to my client to have them check something out.
Joe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic