You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Ruby <st...@rubysolutions.com> on 2001/02/07 20:54:41 UTC

Session Timeout Config in Catalina


Under Tomcat4 my web.xml which contains (for an individual webapp)

    <session-config>
        <session-timeout>480</session-timeout>
    </session-config>

</web-app>


at the end throws:
org.xml.sax.SAXParseException: Element "web-app" does not allow "session-config" here.


Where does it go?? The exact same web.xml file works under 3.2.1

Re: Session Timeout Config in Catalina

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Steve Ruby wrote:

> Under Tomcat4 my web.xml which contains (for an individual webapp)
>
>     <session-config>
>         <session-timeout>480</session-timeout>
>     </session-config>
>
> </web-app>
>
> at the end throws:
> org.xml.sax.SAXParseException: Element "web-app" does not allow "session-config" here.
>
> Where does it go?? The exact same web.xml file works under 3.2.1
>

The requirement element ordering is specified by the DTD for web application deployment
descriptors, which is (among other places) in the servlet specification -- available at:

    http://java.sun.com/products/servlet/download.html

or in file $CATALINA_HOME/conf/web_22.dtd (for Servlet 2.2)
    $CATALINA_HOME/conf/web_23.dtd (for Servlet 2.3).

Tomcat 3.2.1 lets you get away with out-of-order elements because it does not use a
validating XML parser when reading web.xml files.  Tomcat 4.0 is pickier, and uses a
validating parser, to help you be sure that your web.xml file will be portable to other
containers.

In your particular scenario, you must have put some element before your <session-config>
that is supposed to be *after* <session-config>.  You need to rearrange things in order
for it to work.

Craig McClanahan