problem with web.xml

hi,

i hava a web app that uses struts and some servlets

but when i added the last servlet the web.xml won't validate

i get this exception

Exception initializing TldLocationsCache: XML parsing error on file /WEB-INF/web.xml: (line 125, col 11): 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*)".

i am using tomcat 4.1.31 and jdk 1.4.2

this is my web.xml

<?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>

<listener>

<listener-class>be.test.application.SessionListener</listener-class>

</listener>

<servlet>

<servlet-name>testLauncher</servlet-name>

<servlet-class>be.test.application.TestLauncher</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<init-param>

<param-name>debug</param-name>

<param-value>3</param-value>

</init-param>

<init-param>

<param-name>detail</param-name>

<param-value>3</param-value>

</init-param>

<init-param>

<param-name>validate</param-name>

<param-value>false</param-value>

</init-param>

<load-on-startup>0</load-on-startup>

</servlet>

<servlet>

<servlet-name>pdfcatalogue</servlet-name>

<servlet-class>be.test.servlets.PdfServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>pdfcatalogue</servlet-name>

<url-pattern>/pdfcatalogue</url-pattern>

</servlet-mapping>

<mime-mapping>

<extension>pdf</extension>

<mime-type>application/pdf</mime-type>

</mime-mapping>

<session-config>

<session-timeout>30</session-timeout>

</session-config>

<welcome-file-list>

<welcome-file>/jsp/index.jsp</welcome-file>

</welcome-file-list>

<error-page>

<error-code>404</error-code>

<location>/jsp/common/404.jsp</location>

</error-page>

<error-page>

<error-code>500</error-code>

<location>/jsp/common/500.jsp</location>

</error-page>

<taglib>

<taglib-uri>/tlds/struts-html.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/struts-bean.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/struts-logic.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/struts-tiles.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/ff-list.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/ff-list.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/ff-html.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/ff-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/eshop.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/eshop.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/tlds/agora.tld</taglib-uri>

<taglib-location>/WEB-INF/tlds/agora.tld</taglib-location>

</taglib>

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/eshopDB</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

all worked fine till i added this

<servlet>

<servlet-name>pdfcatalogue</servlet-name>

<servlet-class>be.test.servlets.PdfServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>pdfcatalogue</servlet-name>

<url-pattern>/pdfcatalogue</url-pattern>

</servlet-mapping>

<mime-mapping>

<extension>pdf</extension>

<mime-type>application/pdf</mime-type>

</mime-mapping>

[5930 byte] By [MrChilla] at [2007-10-2 13:40:08]
# 1

Your doctype declaration should look like:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

And if you look at http://java.sun.com/dtd/web-app_2_3.dtd you will see the <mime-mapping> element should be ordered after the <session-config> element:

<!ELEMENT web-app (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*)>

YoGeea at 2007-7-13 11:32:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...