1 Reply Latest reply on Sep 17, 2008 4:26 PM by Javier Carazo

    Exception redirection doesn't work for some exceptions

    Javier Carazo Newbie

      Hi,
      I have this in my page.xml


          <exception class="org.jboss.seam.security.AuthorizationException">
              <redirect view-id="/error.xhtml">
                  <message>You don't have permission to do this</message>
              </redirect>
          </exception>
          
          <exception class="org.jboss.seam.security.NotLoggedInException">
              <redirect view-id="/error.xhtml">
                  <message>Please log in first</message>
              </redirect>
          </exception>
          
          <exception class="javax.faces.application.ViewExpiredException">
              <redirect view-id="/error.xhtml">
                  <message>Your session has timed out, please try again</message>
              </redirect>
          </exception>



      And I can view the error.xhtml page when one of these exceptions occur.


      Also I have this in page.xml


          <exception>
              <redirect view-id="/error.xhtml">
                  <message>Unexpected error, please try again</message>
              </redirect>
          </exception>



      At some point my application gives an exception:



      javax.faces.el.EvaluationException: javax.el.ELException: /step4.xhtml @283,104 value="#{categoryList.getCategoriesByPackage(package)}": javax.ejb.EJBTransactionRolledbackException
           at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:106)
           at com.sun.facelets.component.UIRepeat.getValue(UIRepeat.java:143)
           at com.sun.facelets.component.UIRepeat.getDataModel(UIRepeat.java:121)
           at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:305)
           at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:333)
      .....
      .....
      Caused by: javax.el.ELException: /step4.xhtml @283,104 value="#{categoryList.getCategoriesByPackage(package)}": javax.ejb.EJBTransactionRolledbackException
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
           at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:102)
           ... 59 more
      Caused by: javax.ejb.EJBTransactionRolledbackException
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
      ....
      ....
      Caused by: java.lang.NullPointerException
           at com.myapplication.action.CategoryListAction.getCategoriesByPackage(CategoryListAction.java:65)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      
      



      I want to redirect this exception to the error.xhtml page like the other exceptions.
      Ive tried with:


         


         <exception class="javax.faces.el.EvaluationException">
              <redirect view-id="/error.xhtml">
                  <message>Test</message>
              </redirect>
          </exception>





      or


         


      <exception class="javax.ejb.EJBTransactionRolledbackException">
              <redirect view-id="/error.xhtml">
                  <message>Test</message>
              </redirect>
          </exception>





      or



          <exception class="java.lang.NullPointerException">
              <redirect view-id="/error.xhtml">
                  <message>Test</message>
              </redirect>
          </exception>



      But always I get the stack trace and not the error.xhtml page.


      What´s wrong??? What I have to do to redirect this exception to the error.xhtml


      In components.xml I have:


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



      I´m a bit confused.


      (Seam 2.0.2 GA and JBoss 4.2.2 GA)