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

Servlets don't start in tomcat 4.1

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to make some tests using servlets in Tomcat 4.1.18 but I recieved an error and I can't figure out why.

The error is the 404. I have my servlet class in the directory "webapps\mywebapp\WEB-INF\classes\mypackage\"
And I am trying to access it using the following URL: "http://localhost:8080/mywebapp/servlet/mypackage.ServletName
but it doesn't work . I was using some examples from a book but those dont work either.
Does anybody know what am I doing wrong? Since I can load the servlet examples that come with Tomcat I guess I am missing something.
Thank you in advance.
 
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
We get this one alot!
In order to use the /servlet/ style of addressing a servlet you need to have the "invoker" servlet turned on in the particular web application. See the web.xml in the examples to see it in use.
The /servlet/ thing is supposed to be a "convenience" item and was turned on by default in Tomcat for earlier versions. In the current version it is turned off. Look also at the web.xml in /conf
Bill
 
A. Mazon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,
I decided to use Tomcat 4.0 which is the version that comes with the CD I have and it is working fine. I will have to read the documentation to try to make the things work in the 4.1 version but for now I am ok with the old one.
Thank you!
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just downloaded and installed Tomcat 4.1.24 and am also receiving 404 errors when I attempt to run servlets.
The "invoker" tags are not commented out in the config\web.xml file.
Here's info on my problem:
servlet class location: "webapps\chapter01\WEB-INF\classes\HelloWorldServlet.class"
web.xml: contains tags to define the HelloWorldServlet
URL used to access: "http://localhost:8080/chapter01/servlet/HelloWorldServlet"
I am using the SCWCD Exam Study Kit book, which contains a CD that has complete workable files for this HelloWorldServlet.
So I decided to use install the Tomcat 4.0 version supplied on the CD in the book and now everything works fine.
Does anyone have any additional insight on the problems I experienced with Tomcat 4.1.24?
Thanks!
Louise
 
Louise Haydu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found my problem... when I looked in the conf\web.xml file, I wasn't looking in the right place for the "invoker" tags. The tags that need to be uncommented are as follows:
<!-- The mapping for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
Everything is working fine now!
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic