5 Replies Latest reply on Feb 14, 2013 11:23 AM by Rohit Choudhary

    StatusMessages getting lost after Exception

    German Escobar Newbie

      I have this simple component:

      public class SendMessageBean {
        private StatusMessages statusMessages;
        public String sendMessage() throws Exception {
          statusMessages.addFromResourceBundle(StatusMessage.Severity.ERROR, "app.error");
          throw new UnExpectedException(e);

      It just adds a message to the StatusMessages and throws an Exception. The relevant pages.xml configuration looks like this:

        <exception class="com.myproject.UnExpectedException">
          <redirect view-id="/error.xhtml">
            <message severity="ERROR">An error ocurred</message>

      When the sendMessage() method is called, I'd expected both messages to get shown on error page (the message added to the StatusMessages and the message from the pages.xml configuration). However, only the message from pages.xml is shown.

      AFAIK this should work! The StatusMessages is a conversation scoped component and should survive the redirect.


        • 1. Re: StatusMessages getting lost after Exception
          Rohit Choudhary Newbie


          Were you able to get an answer or workaround for this issue? In my app the StatusMessages keep disappearing when there is some exception in the app.

          I cannot let all the exceptions to be handled by Seam. I have to restart the JBoss server to get the messages to appear again.

          Please advise.



          • 2. Re: StatusMessages getting lost after Exception
            Martin Kouba Master


            the example above works as expected. However you have to use long-running conversation (@Begin, conversation.begin(), etc.), since temporary conversation does not survive redirect.


            I'm not sure about "StatusMessages disappearing" and restarting AS. Provide more info so that we can check :-)

            • 3. Re: StatusMessages getting lost after Exception
              Rohit Choudhary Newbie

              Hello Martin,

              Thanks for quick reply. I have EAP 5.0 running a JSF Seam app ( Seam 2.2.1.EAP5). The database that the app uses goes down every night. I can see exceptions during the night in the logs when JBoss is trying to renew the db connections in the pool. One side-effect (a big one) I see is that the Status Messages stop appearing on the pages once that happens.

              When I restart the JBoss, the messages start appearing on the page again. If the database does not go down and if there is no major uncaught exception in the app,

              the Status Messages work properly in the app for days.

              Is it a bug in Seam version?

              Please advise.



              • 4. Re: StatusMessages getting lost after Exception
                Martin Kouba Master

                Hm, looks odd. What are the other side effects?

                • 5. Re: StatusMessages getting lost after Exception
                  Rohit Choudhary Newbie

                  How to Reproduce

                  1# You must be using the StatusMessage.add() method which gets the message from a .properties file (The message is got via ResourceBundle).

                  2# You execute multiple times the part of your system that is suppose to prompt you the messages. After some executions the messages stop showing up.



                  After decompiling the SEAM class I notice that the ResourceBundle turns NULL after multiple executions, I haven't gone too deep in finding why the ResourceBundle in SEAM is turning NULL, so instead we placed the messages in the database and we retrieve the messages from there.


                  It is important to notice that this issue only happens when the application gets the messages from a properties file. If the message is hardcoded this issue never happens.