users@glassfish.java.net

Exception handling, sun 8.1

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Jun 2009 01:06:49 PDT

Hi All,
         I have an application deployed that uses servlets, struts and tiles to sun application server 8.1. I'm fairly new to all of these, however I am attempting to write error catching in the web.xml. If I have this:

    <error-page>
      <exception-type>java.lang.NoClassDefFoundError</exception-type>
      <location>/WEB-INF/pages/noclass.jsp</location>
  </error-page>

everything works fine and any noclassdeffounderrors are directed to that page. If I also add a 'catch all' exception however to a different page:

    <error-page>
      <exception-type>java.lang.NoClassDefFoundError</exception-type>
      <location>/WEB-INF/pages/noclass.jsp</location>
  </error-page>
  
  <error-page>
      <exception-type>java.lang.Exception</exception-type>
      <location>/WEB-INF/pages/catchall.jsp</location>
  </error-page>

then the second entry (java.lang.Exception) seems to take priority. re-ordering these two in the web.xml doesn't seem to help. Is this a bug in the application server or am I doing something wrong?
[Message sent by forum member 'mj3' (mj3)]

http://forums.java.net/jive/thread.jspa?messageID=352871