1 Reply Latest reply on Mar 7, 2007 11:26 PM by Gavin King

    problem getting exceptions to be directed to /error.xhtml

    Samuel Mendenhall Apprentice

      I need some assistence getting my exceptions routed to my own /error.xhtml page. I have a seam gen'd project from around 3 days old CVS.

      No matter what I do, I can't get seam to redirect to the /error.xhtml after an exception, please help.

      I am getting the page that looks like:
      An Error Occurred:
      ....
      + Stack Trace
      + Component Tree
      + Scoped Variables


      Here is my code, where am I going wrong? I also removed the jboss-seam-debug jar but that only prevents me from seeing the debug.seam page, I still get this page, and I want my error.xhtml.


      components.xml:

      ....
      <core:init debug="false" jndi-pattern="@jndiPattern@"/>
      ....
      


      pages.xml
      <!DOCTYPE pages PUBLIC
       "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
       "http://jboss.com/products/seam/pages-1.2.dtd">
      
      <pages no-conversation-view-id="/index.xhtml" login-view-id="/login.xhtml">
      
       <page view-id="*">
       <navigation>
       <rule if-outcome="home">
       <redirect view-id="/index.xhtml"/>
       </rule>
       </navigation>
       </page>
      
       <exception class="org.jboss.seam.framework.EntityNotFoundException">
       <redirect view-id="/error.xhtml">
       <message>Not found</message>
       </redirect>
       </exception>
      
       <exception class="javax.persistence.EntityNotFoundException">
       <redirect view-id="/error.xhtml">
       <message>Not found</message>
       </redirect>
       </exception>
      
       <exception class="javax.persistence.OptimisticLockException">
       <end-conversation/>
       <redirect view-id="/error.xhtml">
       <message>Another user changed the same data, please try again</message>
       </redirect>
       </exception>
      
       <exception class="org.jboss.seam.security.AuthorizationException">
       <redirect>
       <message>You don't have permission to do this</message>
       </redirect>
       </exception>
      
       <exception class="org.jboss.seam.security.NotLoggedInException">
       <redirect view-id="/login.xhtml">
       <message>Please log in first</message>
       </redirect>
       </exception>
      
       <exception>
       <redirect view-id="/error.xhtml">
       <message>Unexpected error, please try again</message>
       </redirect>
       </exception>
      
      </pages>
      




      The actual Exception that is getting thrown is:
      org.jboss.seam.framework.EntityNotFoundException

      because I am testing with an entity id on my home object that doesn't exist.


      Thanks.