1

Tomcat 8
Servlet 3.1

I'm trying to get default error page to work. This post, for example, is what I'm trying to do.

My web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1">

...

<!--
  <error-page>
    <error-code>404</error-code>
    <location>/error.jsp</location>
  </error-page>
-->
  <error-page>
    <location>/error.jsp</location>
  </error-page>

When I remove the comments I see my error page, when trying to access a non-existent URL. With the comments in, trying the same URLs, my browser just returns a 404.

I can't find anything that says this behaviour changed between 3.0 and 3.1 and I can't see any errors in the tomcat logs.

TedTrippin
  • 3,525
  • 5
  • 28
  • 46

0 Answers0