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.
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
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!
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
Joined: Aug 17, 2000
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!