Hi Robert
I think I may know what your problem is. I remember reading that you web.xml has to be
in a specific order:
in your
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
you need to swap the <description> and the <servlet-class> items around:
<servlet>
<servlet-name>HelloWorld</servlet-name>
<description>
My test servlet
</description>
<servlet-class>HelloWorld</servlet-class>
</servlet>
Here is the part I was talking about. It's from the application developers guide in
the tomcat docs : tomcat-docs\appdev\deployment.html
NOTE - The Servlet Specification includes a Document Type Descriptor (DTD) for the web
application deployment descriptor, and Tomcat 4 enforces the rules defined here when
processing your application's /WEB-INF/web.xml file. In particular, you must enter
your descriptor elements (such as <filter>, <servlet>, and <servlet-mapping> in the
order defined by the DTD (see Section 13.3).
hope this helps.
Cheers
Dom
----- Original Message -----
From: Robert Seeger
To: [EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 12:08 PM
Subject: Issues with web.xml
I'm having issues with the web.xml file in my webapps/root/web-inf
directory. What I want to do is be able to specify each individual
servlet that can be run, by using <servlet> and <servlet-mapping> tags.
Unfortunately, the best I have been able to do is use a generic servlet
invoker to allow every servlet to be accessed. When I try to set things
up so that only one servlet can be accessed, there are errors showing up
in the dos box when I start Tomcat... which proceed to scroll of the
screen faster than I can look at them. They do not show up in any of the
logfiles in the logs directory. I was hoping someone could take a look
at the web.xml file I'm using and tell me if my error is an obvious one,
and how to fix it. I tried everything I could think of to make it work,
and checked all the documentation I could find.
I'm running Tomcat 4.1.24 on Windows 98.
Thank you in advance,
Robert Seeger
---------- Working web.xml, that allows all servlets in the directory to
be accessed ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------- Non-working web.xml that causes errors ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]