0

I tried to use a new servlet 3.0 feature with jetty maven plugin.

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>8.1.5.v20120716</version>
</plugin>

part of my web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  version="3.0"> 
  ...
  <error-page>
    <location>/info/error</location>
  </error-page>
</web-app>

In my understanding you can set a default error page in servlet 3.0. When I test this with mvn jetty:run and an arbitrary exception it does not work. Jetty shows just the stacktrace as it would do without the error-page configuration. When I run it with tomcat7:run it does work.

I searched eclipse bug database and jetty documentation but haven't found any information about this.

Can somebody confirm this is a bug in jetty?

Janning Vygen
  • 8,877
  • 9
  • 71
  • 102

1 Answers1

0

You must have either an error-code or an exception-type along with the location.

That said, jetty should throw an error when parsing web.xml without one of those two elements, so I've opened a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=392239

pb2q
  • 58,613
  • 19
  • 146
  • 147
Jan
  • 1,287
  • 7
  • 7
  • OP is using Servlet 3.0. The global error page is a new Servlet 3.0 feature. See also among others figure 14-10 in Servlet 3.0 spec and https://blogs.oracle.com/arungupta/entry/totd_136_default_error_page What you're stating is only true for Servlet 2.5 or older. Tomcat 7 made the same mistake by the way. They initially ignored my bug report, but implemented it anyway: https://issues.apache.org/bugzilla/show_bug.cgi?id=52135 – BalusC Oct 18 '12 at 03:32
  • I have opened a bug on the specification. See http://java.net/jira/browse/SERVLET_SPEC-49. This needs to be added to the 3.1 specification. Assuming that it will be, I will reopen https://bugs.eclipse.org/bugs/show_bug.cgi?id=392239. – Jan Oct 18 '12 at 04:58
  • regardless what servlet specification says, I would consider this a great feature. And I don't think having this feature is violating the specification. But the other way round it might be the same. So why not pick it up and let jetty have another great feature. – Janning Vygen Oct 18 '12 at 07:37
  • Janning - I've done it already. See status of https://bugs.eclipse.org/bugs/show_bug.cgi?id=392239 – Jan Oct 18 '12 at 21:33
  • Great, Jan! Thank you so much for developing jetty – Janning Vygen Nov 02 '12 at 11:55