1 Reply Latest reply on May 14, 2008 12:15 PM by pmuir

    Where am I wrong in doing exception handling ?

    josief

      I really have trouble in exception handling! Please tell me what I did wrong :


      1 - I set facelets development to false in web.xml


      2 - I turned off the debug mode in components.xml


      3 - I modified the pages.xml such as any exception must display a standard error page :


      <exception>
           <redirect view-id="/error/error.xhtml">
               <message>#{org.jboss.seam.handledException.message}</message>
           </redirect>
      </exception>




      My CustomException class :


      @Redirect(viewId = "/error/customException.xhtml", message = "Not a valid DicomDir")
      @ApplicationException(rollback = true)
      public class CustomException extends RuntimeException {}



      What I expect is if my application code launch an exception then the /error/customException.xhtml view will be displayed. Otherwise, any exception will lead to the standard error page.


      But it doesn't work! All I get is the exception stack in the log and my long-running conversation ends.


      My exception doesn't seem to be caught by the Seam exception handler. In the logs, it looks like the exception is caught somewhere and wrapped into a WARN debug :


      [...]
      09:29:40,763 WARN  [lifecycle] executePhase(APPLY_REQUEST_VALUES 2,com.sun.faces.context.FacesContextImpl@4d79d5) threw exception
      javax.faces.FacesException: /importData/uploadDicomDir.xhtml @24,43 fileUploadListener="#{dicomReader.listener}": x.y.z.CustomException : bla bla bla.
           at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:109)
      [...]
      09:29:41,373 INFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=null[severity=(INFO 0), summary=(Not a valid DicomDir), detail=(Not a valid DicomDir)]
      



      Please help me I'm stuck!


      Thanks!


      Adrien