8 Replies Latest reply on May 28, 2009 5:18 PM by gonorrhea

    Exception fallback isn't caught

    cash1981

      I have tried scouring the forum for answers in regard to exception handling in seam, however very very few posts has been answered, but I will try my luck anyway,


      In production we have removed the seam-debug.jar file and we are running debug mode false.


      I pages.xml we have supposedly a fallback exception handler which will redirect to /error.xhtml page:


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



      We have a page that results in an exception:


      javax.faces.FacesException: javax.el.ELException: /generic/generic-dialog.xhtml @20,76 rendered="#{templateHandler.needsAddress(attachment.hash)}": javax.ejb.EJBTransactionRolledbackException



      However when we encounter this exception we get An Error occurred page generated by Facelets instead of the redirect to /error.xhtml
      How come? How can we say that all exceptions should just be redirected to the /error.xhtml page?

        • 1. Re: Exception fallback isn't caught
          norman

          You are in debug mode.

          • 2. Re: Exception fallback isn't caught
            gonorrhea

            So how do you determine you are in debug mode?  By navigating to /debug.seam?


            In components.xml, I have the following:


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



            If Shervin hard-codes as follows:


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



            would that solve his problem or is there any other configs you need to do?


            I believe that the variables are specified in the components.properties file but there was a JIRA at one time or another about whether or not the values were being replaced during Ant build of EAR or dynamically read from props file.


            Either way, if you hard-code it like I show above, shouldn't that take you out of debug mode?

            • 3. Re: Exception fallback isn't caught
              gonorrhea

              Well, I was right.  The /debug.seam is not found when you do:


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



              @poster: there is a isDebug() method in org.jboss.seam.core.Init class.  Call that postInit to see if Norman is correct.


              Use this in components.xml:


              <event type="org.jboss.seam.postInitialization">   
                      <action execute="#{foo.bar}"/>
                 </event>



              or a @Startup/@Create method, etc.

              • 4. Re: Exception fallback isn't caught
                cash1981

                Thanks Arbi.
                I am using @debug@ and ant task. I will try to hardcode false and also try a isDebug. Thanks for the tip. I will report back.

                • 5. Re: Exception fallback isn't caught
                  cash1981

                  Norman: I am definetly NOT running in debug mode as I just tested what Arbi wrote and the output was:


                  28 May 09 09:55:07, ERROR  my.package.dao.DebugMode:foo:13 Are you in debug mode? false


                  So again to my question. Why does the Generated by Facelets exception appear? And Why doesnt pages.xml catch that and redirect to /error.xhtml

                  • 6. Re: Exception fallback isn't caught
                    cash1981

                    Can it be because of this in web.xml?



                         <context-param>
                              <param-name>facelets.DEVELOPMENT</param-name>
                              <param-value>true</param-value>
                         </context-param>



                    • 7. Re: Exception fallback isn't caught
                      cash1981

                      I can confirm that that was the case.
                      I feel stupid now :-)

                      • 8. Re: Exception fallback isn't caught
                        gonorrhea

                        It would be nice if there was one global debug setting, not one for Seam, one for Facelets, one for foo...