The digester error actually provides you more info than you think :
org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*, filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*, welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*, security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
See , servlet definitions come first. Define them first, then the associated mapping if needed. The order in which you define the servlets
themselves do not matter, what matters is that servlet defiinitions come first before the mapping.
You can have a look at the full dtd here : http://java.sun.com/dtd/web-app_2_3.dtd
Paul Wallace wrote:
Hi, I located the problem. I was mapping a different Servlet before the OpenResource Servlet was defined in web.xml (error):
<web-app>
<servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>com.ia.mapping.servlets.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/LoginServlet</url-pattern> </servlet-mapping>
<servlet> <servlet-name>OpenResource</servlet-name> <servlet-class>com.ia.mapping.servlets.OpenResource</servlet-class> </servlet> </web-app>
It now runs, with the mapping after any Servlet declaration. This would
seem logical but for the fact that the mapped Servlet preceded the
Servlet mapping? I suppose this means that no matter how many Servlet
entries there are, mappings MUST proceed ALL Servlet declarations thus:
<servlet> <servlet-name></servlet-name> <servlet-class></servlet-class> </servlet> <servlet> <servlet-name></servlet-name> <servlet-class></servlet-class> </servlet> <servlet> <servlet-name></servlet-name> <servlet-class></servlet-class> </servlet>
<servlet-mapping> <servlet-name></servlet-name> <url-pattern></url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name></servlet-name> <url-pattern></url-pattern> </servlet-mapping>
irrespective to the Servlet they map to?
Thanks
Paul.
Hard to tell from a small snippet like that , but if I had to guess, it
doesn't appear to meet the dtd specified by the web.xml. Try sending us the entire web.xml in your email.
Paul Wallace wrote:
*Hi All, After implementing my simple Servlet under Tomcat thus:
<servlet> <servlet-name>OpenResource</servlet-name> <servlet-class>com.ia.mapping.servlets.OpenResource</servlet-class> </servlet>
where the Servlet OpenResource has been compiled in the correct directory, containing no functionality (below), I start up Tomcat and get the less-than-pleasant error message in the console:
Starting service Tomcat-Standalone
Apache Tomcat/4.0.4
PARSE error at line 19 column 11
org.xml.sax.SAXParseException: The content of element type "web-app"
must match
"(icon?,display-name?,description?,distributable?,context-param*,filter
,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,r
mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,
esource-ref*,j
security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,e
nob-local-ref*)". Starting service Tomcat-Apache Apache Tomcat/4.0.4
This error message immediately suggests that web.xml is not fully
formed. It is. When the OpenResource entry is removed, TC starts up
fine, suggesting the Servlet is at fault. But on inspection, there is
source present to cause such a problem (it is a bare-bones Servlet).although
I have looked and looked, but cant see what's at fault. (Tomcat
appearing to have started does not serve anything (404)).
Thanks for any help or insight into this error message.
Paul.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
