The default servlet invoker was disabled by default for security reasons
which is why you are getting a 404 error. It can be re-enabled by
uncommenting the mapping for the url pattern /servlet/* in
$TOMCAT_HOME/conf/web.xml. You will need to restart Tomcat after doing this.
<!--
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
-->
Also, when you talk about the steps you go through to deploy the servlet,
Tomcat isn't currently running, is it? The problem of Tomat running while
you are doing these steps is that Tomcat auto-deploys webapps upon seeing a
new directory or .war file in the webapps directory. If you create a
directory and then add all the other stuff underneath that, Tomcat will
have attempted the deploy before everything is in place. You should build
the directory structure and then copy the whole finished thing to the
webapps directory if you want to deploy stuff like that.
As far as needing a web.xml file, this is pretty basic stuff. Yes, you do.
You really should buy a servlet book like Jason Hunter's Java Servlet
Programming, 2nd edition. Also, you can read the servlet spec on Sun's
site. It is apparent that you are attempting to use Tomcat without knowing
what it is all about in the first place. Taking a day to read up on
servlets and then moving forward with Tomcat will be of immense benefit to
you and remove a lot of frustration from the whole process.
Jake
At 09:53 AM 9/29/2002 -0700, you wrote:
>Hi All,
>
>I would really appreciate some help this... I am on an NT box with Tomcat
>4.1.12. My problem is that I am having trouble deploying servlets in
>Tomcat. Worse, I seem to go through this each time I upgrade to a new
>version of Tomcat. Friday night I upgraded to version 4.1.12. Each time I
>upgrade I have problems getting simple servlets to execute - after a
>couple of hours of monkeying around my servlets suddenly ststart
>working. I think I'm repeating the same steps over and over so I don't
>understand what I'm doing wrong and what I did right to make things
>work. Which is frustrating because it means I'm not learning from the
>process. Please note, I can get the Tomcat servlet examples to execute so
>I'm pretty confident I have a good installation. If I copy one of the
>examples, say "HelloWorldExample" to one of my directories it no longer works.
>
>Here are the steps I am following to deploy a simple "Hello World" servlet::
>
>1) In webapps I create a directory named "hello".
>2) In "hello" I create the "WEB-INF" directory.
>3) Inside the "WEB-INF" directory I place "web.xml". (I'm not sure I
>need to do this...)
>4) I also add "classes" and "lib" directories under "WEB-INF".
>5) Under classes I create a directory name "hello".
>6) In "hello" I place the my servlet "hello.HelloMike.class". The name
>of the servlet is "HelloMike" and it resides in package "hello".
>7) I start Tomcat and attempt to browse to the servlet with the following
>url "http://localhost:8080/hello/servlet/hello.HelloMike"
>8) The browser returns the following:
>
>HTTP Status 404 - /hello/servlet/hello.HelloMike
>*type* Status report
>*message* _/hello/servlet/hello.HelloMike_
>*description* _The requested resource (/hello/servlet/hello.HelloMike) is
>not available._
>Apache Tomcat/4.1.12
>
>I'm really mystifyied as to what I am doing wrong and would greatly
>appreciate all insights and suggestions offerred.
>
>Many thanks,
>Mike
>
>
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>