8.12.2. Dealing with errors


However carefully your application is designed to queue concurrent requests to your conversational component, there is a risk that the server will overload. When overload occurs, not all requests will be processed before the concurrent-request-timeout period expires. In this case, Seam throws a ConcurrentRequestTimeoutException, which is handled in pages.xml. We recommend sending a HTTP 503 error:
<exception class="org.jboss.seam.ConcurrentRequestTimeoutException" 
           log-level="trace"> 
  <http-error error-code="503" /> 
</exception>
Copy to Clipboard Toggle word wrap

Note

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.
Alternatively you could redirect to an error page:
<exception class="org.jboss.seam.ConcurrentRequestTimeoutException" 
           log-level="trace"> 
  <end-conversation/> 
  <redirect view-id="/error.xhtml"> 
    <message>
      The server is too busy to process your request, 
      please try again later
    </message> 
  </redirect> 
</exception>
Copy to Clipboard Toggle word wrap
ICEfaces, RichFaces AJAX and Seam Remoting can all handle HTTP error codes. Seam Remoting will pop up a dialog box showing the HTTP error. ICEfaces will indicate the error in its connection status component. RichFaces provides the most complete support for handling HTTP errors by providing a user definable callback. For example, to show the error message to the user:
<script type="text/javascript"> 
  A4J.AJAX.onError = function(req,status,message) { 
    alert("An error occurred"); 
  }; 
</script>
Copy to Clipboard Toggle word wrap
If, rather than an error code, the server reports that the view has expired, perhaps because a session timed out, use a separate callback function in RichFaces:
<script type="text/javascript"> 
  A4J.AJAX.onExpired = function(loc,message) { 
    alert("View expired"); 
  }; 
</script>
Copy to Clipboard Toggle word wrap
Alternatively, you can allow RichFaces to handle the error. In this case, the user will receive a prompt reading, "View state could not be restored — reload page?" This message can be globally customized by setting the following message key in an application resource bundle:
AJAX_VIEW_EXPIRED=View expired. Please reload the page.
Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat